aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@adacore.com>2022-08-19 16:25:45 +0000
committerMarc Poulhiès <poulhies@adacore.com>2022-09-06 09:14:22 +0200
commit63499dbd7dd5c8ea814d07e0e6f5c254ff403a5b (patch)
treef038611ae557e06957d295a27708bd46d07393ba /gcc
parent1c245f7273f170f3236f30562a72567be648c300 (diff)
downloadgcc-63499dbd7dd5c8ea814d07e0e6f5c254ff403a5b.zip
gcc-63499dbd7dd5c8ea814d07e0e6f5c254ff403a5b.tar.gz
gcc-63499dbd7dd5c8ea814d07e0e6f5c254ff403a5b.tar.bz2
[Ada] Disable if expression optimization for LLVM
gcc/ada/ * exp_ch4.adb (Expand_N_If_Expression): Disable optimization for LLVM.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/exp_ch4.adb5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 18fb88f..0b7e391 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -6135,6 +6135,10 @@ package body Exp_Ch4 is
-- itself such a slice, in order to catch if expressions with more than
-- two dependent expressions in the source code.
+ -- Also note that this creates variables on branches without an explicit
+ -- scope, causing troubles with e.g. the LLVM IR, so disable this
+ -- optimization when Unnest_Subprogram_Mode (enabled for LLVM).
+
elsif Is_Array_Type (Typ)
and then Number_Dimensions (Typ) = 1
and then not Is_Constrained (Typ)
@@ -6151,6 +6155,7 @@ package body Exp_Ch4 is
and then
OK_For_Single_Subtype (Etype (Thenx), Etype (Prefix (Elsex)))))
and then not Generate_C_Code
+ and then not Unnest_Subprogram_Mode
then
declare
Ityp : constant Entity_Id := Base_Type (Etype (First_Index (Typ)));