aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2020-05-15 20:27:18 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2020-07-08 10:55:49 -0400
commit964a8141e1953e28ae236d1a2f1732c91f458cf6 (patch)
tree668b8111b1f859f67c971893b67f8bb84d1dff2a
parent3452f4b72db6630ab80cb16d8cff2a5e531f4820 (diff)
downloadgcc-964a8141e1953e28ae236d1a2f1732c91f458cf6.zip
gcc-964a8141e1953e28ae236d1a2f1732c91f458cf6.tar.gz
gcc-964a8141e1953e28ae236d1a2f1732c91f458cf6.tar.bz2
[Ada] Extend optimization to True/False prefixed with Standard
gcc/ada/ * exp_ch5.adb (Expand_N_If_Statement): Detect True/False prefixed with Standard.
-rw-r--r--gcc/ada/exp_ch5.adb12
1 files changed, 6 insertions, 6 deletions
diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb
index caacda6..6992528 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