From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4001:c0b::230; helo=mail-it0-x230.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-it0-x230.google.com (mail-it0-x230.google.com [IPv6:2607:f8b0:4001:c0b::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id A6F9521B02820 for ; Thu, 7 Dec 2017 09:38:57 -0800 (PST) Received: by mail-it0-x230.google.com with SMTP id z6so16664692iti.4 for ; Thu, 07 Dec 2017 09:43:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=GdgHcSdZcq/RK6lzN7vNVeT9a7WzFuiV8xryzpxgu1w=; b=ev307mSstis8jS220ygx3BA6jBXLvDAm2oIwUkA7iOxvbfsXkja/zTF9xlds9oYT79 6xHMEa1v8WVN7jsJUVIEoo09fe3hhoYqRPvZbnhspEOXjHhkzp5Sku8h7D+cR2eGFmB8 CYRWPFmLhhgVD3y0BKrkGbrYcqRLuODlcX30E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=GdgHcSdZcq/RK6lzN7vNVeT9a7WzFuiV8xryzpxgu1w=; b=M1fdhrDCDqYFChs2lha3c5hZ4gtbk98gekgAhsV0N3D1ma0vGhVKjqVFnWhGXmJKMz 4JZttxIOP4FGAxQCAakdypM32tZJ/RoXs1Nefi3WzTxNuYBAVxJ7kKDibdH/LV5Yr1rz iPi39V8n7msB5+02bJm4xIw4/BST+3d2fRDeKX1uu/5sbAVI/DZ6VppVRD2u7FcXEx22 2sezpwBLeSPwD/N1PL0lWHWCvWtGmhyJOZRIXld1ByRYxCZ0dua3NGD+vN4BWKKiadNV K1b4HmS6LvGh6Iows1AuaCYu9+8fbj9meYgSxCJCGVLh9BCOQK632+hXCM/xGd2s4DfC i/ig== X-Gm-Message-State: AJaThX6OceukGJ/RN3g9IWGTlFzDZIrBNUx+ML6jMDTV7HV5IpVWjbWR UutYNS7hID+TUD8GIo4s+jl3ibxRq0rU8sShoznBTA== X-Google-Smtp-Source: AGs4zMaMCLqHYRkfPTYkcprq75FIeVCbPnqpsq+9YPG1Xpz7e61K8H5ofo87PwVNlPRytuJWdDbQhy0PLdSPvojofys= X-Received: by 10.107.2.137 with SMTP id 131mr40749651ioc.186.1512668610311; Thu, 07 Dec 2017 09:43:30 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.104.16 with HTTP; Thu, 7 Dec 2017 09:43:29 -0800 (PST) In-Reply-To: References: <20171207151208.25648-1-ard.biesheuvel@linaro.org> From: Ard Biesheuvel Date: Thu, 7 Dec 2017 17:43:29 +0000 Message-ID: To: "Kinney, Michael D" Cc: Alexei Fedorov , "edk2-devel@lists.01.org" , "Gao, Liming" , Leif Lindholm 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:38:57 -0000 Content-Type: text/plain; charset="UTF-8" On 7 December 2017 at 17:36, Kinney, Michael D wrote: > Ard, > > With link time optimization, the current order produces > smaller code. > I don't think it does. You are essentially saying that DebugAssertEnabled() may resolve to a link time constant FALSE under LTO. In that case, why would the following two statement not be equivalent? if (FALSE && EFI_ERROR (StatusParameter)) {} if (EFI_ERROR (StatusParameter) && FALSE) {} (which is essentially what a nested if () resolves to) In other words, the compiler is smart enough to drop the status check in the second case, because it can see there are no side effects, and the condition can never be made true anyway. > Without link time optimization, your patch will produce > smaller code, but not as small as link time optimized code. >