From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 9F00D1A1E45 for ; Thu, 29 Sep 2016 17:25:39 -0700 (PDT) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP; 29 Sep 2016 17:25:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,417,1473145200"; d="scan'208,217";a="14744617" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga005.fm.intel.com with ESMTP; 29 Sep 2016 17:25:39 -0700 Received: from fmsmsx123.amr.corp.intel.com (10.18.125.38) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 29 Sep 2016 17:25:38 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx123.amr.corp.intel.com (10.18.125.38) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 29 Sep 2016 17:24:28 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.15]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.234]) with mapi id 14.03.0248.002; Fri, 30 Sep 2016 08:24:27 +0800 From: "Gao, Liming" To: Laszlo Ersek CC: "edk2-devel@ml01.01.org" , Ard Biesheuvel , "Justen, Jordan L" Thread-Topic: [edk2] [Patch 4/4] BaseTools Makefile: Enable Ofast option for GCC tool chain Thread-Index: AQHSGlujbCDnpvwYIE+qoowp9/pCSqCQRAKAgADofUA= Date: Fri, 30 Sep 2016 00:24:26 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14B47EDEF@shsmsx102.ccr.corp.intel.com> References: <1475158367-13120-1-git-send-email-liming.gao@intel.com> <1475158367-13120-5-git-send-email-liming.gao@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiM2FjZmI0NzItMmNmNC00MWE3LWFlMDktOWU0OWMzMWM2YWEyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IkRjcEdDYXFOWGtXbm8xekFHWm9RV2h3QTFYQzViQmRJeklLXC84Ym4rNmdnPSJ9 x-originating-ip: [10.239.127.40] MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: Re: [Patch 4/4] BaseTools Makefile: Enable Ofast option for GCC tool chain X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Sep 2016 00:25:39 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Laszlo: Thanks for your suggestion. I will try O2 option and see the performance= and warning. Thanks Liming From: Laszlo Ersek [mailto:lersek@redhat.com] Sent: Friday, September 30, 2016 2:30 AM To: Gao, Liming Cc: edk2-devel@ml01.01.org; Ard Biesheuvel ; Jus= ten, Jordan L Subject: Re: [edk2] [Patch 4/4] BaseTools Makefile: Enable Ofast option for= GCC tool chain Hi Liming, On 09/29/16 16:12, Liming Gao wrote: > Enable Ofast option to generate fast code for performance improvement. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Liming Gao > --- > BaseTools/Source/C/Makefiles/header.makefile | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/BaseTools/Source/C/Makefiles/header.makefile b/BaseTools/Sou= rce/C/Makefiles/header.makefile > index f2041f8..ca2dc2e 100644 > --- a/BaseTools/Source/C/Makefiles/header.makefile > +++ b/BaseTools/Source/C/Makefiles/header.makefile > @@ -44,12 +44,12 @@ ARCH_INCLUDE =3D -I $(MAKEROOT)/Include/AArch64/ > endif > > INCLUDE =3D $(TOOL_INCLUDE) -I $(MAKEROOT) -I $(MAKEROOT)/Include/Common = -I $(MAKEROOT)/Include/ -I $(MAKEROOT)/Include/IndustryStandard -I $(MAKERO= OT)/Common/ -I .. -I . $(ARCH_INCLUDE) > -BUILD_CPPFLAGS =3D $(INCLUDE) > +BUILD_CPPFLAGS =3D $(INCLUDE) -Ofast > ifeq ($(DARWIN),Darwin) > # assume clang or clang compatible flags on OS X > -BUILD_CFLAGS =3D -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -W= no-deprecated-declarations -Wno-self-assign -nostdlib -c -g > +BUILD_CFLAGS =3D -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -W= no-deprecated-declarations -Wno-self-assign -Wno-unused-result -nostdlib -c= -g > else > -BUILD_CFLAGS =3D -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -W= no-deprecated-declarations -nostdlib -c -g > +BUILD_CFLAGS =3D -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -W= no-deprecated-declarations -Wno-unused-result -nostdlib -c -g > endif > BUILD_LFLAGS =3D > BUILD_CXXFLAGS =3D > are you sure -Ofast is a good idea? The gcc manual says, -Ofast Disregard strict standards compliance. -Ofast enables all -O3 optimizations. It also enables optimizations that are not valid for all standard-compliant programs. It turns on -ffast-math and the Fortran-specific -fno-protect-parens and -fstack-arrays. To me this sounds quite scary -- I'm worried it might break the base utilities in various obscure ways, which in turn could break the firmware built with these tools in obscure ways. Most upstream projects and GNU/Linux distributions use -O2 for performance-optimized builds. Can you try that please and see if the performance improvements (relative to the current status) are still acceptable? If so, I would strongly prefer -O2 over -Ofast. Also, while building BaseTools with your series applied (using gcc-4.8), I saw one warning issued: > g++ -c -I Pccts/h -I .. -I ../Include/Common -I ../Include/ -I ../Include= /IndustryStandard -I ../Common/ -I .. -I . -I ../Include/X64/ -Ofast VfrFor= mPkg.cpp -o VfrFormPkg.o > VfrFormPkg.cpp: In member function 'void CIfrRecordInfoDB::IfrUpdateRecor= dInfoForDynamicOpcode(BOOLEAN)': > VfrFormPkg.cpp:1360:91: warning: deprecated conversion from string consta= nt to 'CHAR8* {aka char*}' [-Wwrite-strings] > gCVfrErrorHandle.PrintMsg (0, "Error", "Can not find the adjust offset in= the record."); ^ Thanks! Laszlo