From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Permerror (SPF Permanent Error: More than 10 MX records returned) identity=mailfrom; client-ip=192.55.52.93; helo=mga11.intel.com; envelope-from=michael.d.kinney@intel.com; receiver=edk2-devel@lists.01.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 347B4221EA0A4 for ; Thu, 7 Dec 2017 09:31:45 -0800 (PST) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Dec 2017 09:36:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,373,1508828400"; d="scan'208";a="185014249" Received: from orsmsx107.amr.corp.intel.com ([10.22.240.5]) by fmsmga006.fm.intel.com with ESMTP; 07 Dec 2017 09:36:18 -0800 Received: from orsmsx158.amr.corp.intel.com (10.22.240.20) by ORSMSX107.amr.corp.intel.com (10.22.240.5) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 7 Dec 2017 09:36:18 -0800 Received: from orsmsx113.amr.corp.intel.com ([169.254.9.187]) by ORSMSX158.amr.corp.intel.com ([169.254.10.25]) with mapi id 14.03.0319.002; Thu, 7 Dec 2017 09:36:17 -0800 From: "Kinney, Michael D" To: Ard Biesheuvel , "Kinney, Michael D" CC: Alexei Fedorov , "edk2-devel@lists.01.org" , "Gao, Liming" , "Leif Lindholm" Thread-Topic: [edk2] [PATCH] MdePkg/DebugLib; swap if conditions in ASSERT_[EFI|RETURN]_ERROR Thread-Index: AQHTb23ut8WaJ0TL/kqjkH352S+EyKM4hrqA//+TugCAAIkegIAAAQwA//9/6eA= Date: Thu, 7 Dec 2017 17:36:17 +0000 Message-ID: References: <20171207151208.25648-1-ard.biesheuvel@linaro.org> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMWNlZTU4MzQtYWI5YS00YWQ1LWE1YTQtMDYyODEzOTNjYWExIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJ0d1RlcnREUTgyTFlYQyswR3ZWckZXU3lqZEU5TXNWbFp3RU5ITjZuWWphaFFtTWtxSk94cFwvWWExc25VMGdkNyJ9 dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.22.254.139] MIME-Version: 1.0 Subject: Re: [PATCH] MdePkg/DebugLib; swap if conditions in ASSERT_[EFI|RETURN]_ERROR X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Dec 2017 17:31:46 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Ard, With link time optimization, the current order produces smaller code. =20 Without link time optimization, your patch will produce smaller code, but not as small as link time optimized code. Mike > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] > On Behalf Of Ard Biesheuvel > Sent: Thursday, December 7, 2017 9:13 AM > To: Kinney, Michael D > Cc: Alexei Fedorov ; edk2- > devel@lists.01.org; Gao, Liming ; > Leif Lindholm > Subject: Re: [edk2] [PATCH] MdePkg/DebugLib; swap if > conditions in ASSERT_[EFI|RETURN]_ERROR >=20 > On 7 December 2017 at 17:09, Ard Biesheuvel > wrote: > > On 7 December 2017 at 17:01, Kinney, Michael D > > wrote: > >> Ard, > >> > >> The reason for the current ordering is for size > optimization. > >> > >> The most common implementation of DebugAssertEnabled() > uses > >> a FixedAtBuild PCD to determine if these are enabled. > The > >> check of status can be optimized away if they are > disabled. > >> If you reverse them, then the status check is always > performed. > >> > > > > DebugAssertEnabled() is a function call that gets > resolved at link > > time, and is not annotated as being free of side > effects. So I agree > > that the implementation of that function could be > optimized into a > > 'return true' or 'return false' depending on the > compile time values > > of those PCDs, but the way the macro is defined > currently, it still > > requires the function call to be made, and the > conditional compare > > with a constant that follows will still be present in > the code. > > > > What I am suggesting is to replace it with a comparison > with a > > constant, and a conditional function call instead. This > will not > > affect code size, but will only remove needless > function calls at > > runtime. >=20 > Please refer to these threads for details: > https://lists.01.org/pipermail/edk2-devel/2017- > December/018790.html > https://lists.01.org/pipermail/edk2-devel/2017- > December/018809.html > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel