From: Piotr Trojanek Date: Fri, 15 May 2020 18:27:18 +0000 (+0200) Subject: [Ada] Extend optimization to True/False prefixed with Standard X-Git-Tag: basepoints/gcc-12~6340 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=964a8141e1953e28ae236d1a2f1732c91f458cf6;p=thirdparty%2Fgcc.git [Ada] Extend optimization to True/False prefixed with Standard gcc/ada/ * exp_ch5.adb (Expand_N_If_Statement): Detect True/False prefixed with Standard. --- diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb index caacda6e6f0e..699252844da3 100644 --- a/gcc/ada/exp_ch5.adb +++ b/gcc/ada/exp_ch5.adb @@ -3743,9 +3743,9 @@ package body Exp_Ch5 is -- Another optimization, special cases that can be simplified -- if expression then - -- return true; + -- return [standard.]true; -- else - -- return false; + -- return [standard.]false; -- end if; -- can be changed to: @@ -3755,9 +3755,9 @@ package body Exp_Ch5 is -- and -- if expression then - -- return false; + -- return [standard.]false; -- else - -- return true; + -- return [standard.]true; -- end if; -- can be changed to: @@ -3790,9 +3790,9 @@ package body Exp_Ch5 is Else_Expr : constant Node_Id := Expression (Else_Stm); begin - if Nkind (Then_Expr) = N_Identifier + if Nkind_In (Then_Expr, N_Expanded_Name, N_Identifier) and then - Nkind (Else_Expr) = N_Identifier + Nkind_In (Else_Expr, N_Expanded_Name, N_Identifier) then if Entity (Then_Expr) = Standard_True and then Entity (Else_Expr) = Standard_False