From 964a8141e1953e28ae236d1a2f1732c91f458cf6 Mon Sep 17 00:00:00 2001 From: Piotr Trojanek Date: Fri, 15 May 2020 20:27:18 +0200 Subject: [PATCH] [Ada] Extend optimization to True/False prefixed with Standard gcc/ada/ * exp_ch5.adb (Expand_N_If_Statement): Detect True/False prefixed with Standard. --- gcc/ada/exp_ch5.adb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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 -- 2.47.2