diff options
author | Bob Duff <duff@adacore.com> | 2022-09-28 11:24:49 -0400 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2022-10-06 11:22:48 +0200 |
commit | 3e7ff131f47f2a07c497af1c5b2df6bf1ba842fb (patch) | |
tree | 49f7bc25bda32d37fbc73d4d9827ad264ed07936 /gcc | |
parent | 5a841af88be1ce4ff1c69cbb76a5033f2ceec3d6 (diff) | |
download | gcc-3e7ff131f47f2a07c497af1c5b2df6bf1ba842fb.zip gcc-3e7ff131f47f2a07c497af1c5b2df6bf1ba842fb.tar.gz gcc-3e7ff131f47f2a07c497af1c5b2df6bf1ba842fb.tar.bz2 |
ada: Clean up slice-of-component optimization
In the recursive case of Volatile_Or_Independent = False for array
types, fall through into later checks, so for example we check
the type of the prefix of a slice. The pattern here is "return True
in certain cases, otherwise fall through into the final 'return False'".
Remove check for "Ndim = 1"; if Slices is True, then the number of
dimensions is necessarily 1, because Ada doesn't have multi-dimensional
slices.
gcc/ada/
* exp_ch5.adb
(Expand_Assign_Array_Loop_Or_Bitfield): Minor cleanups.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/exp_ch5.adb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb index 9669737..d5d66d9 100644 --- a/gcc/ada/exp_ch5.adb +++ b/gcc/ada/exp_ch5.adb @@ -1632,7 +1632,10 @@ package body Exp_Ch5 is end if; if Is_Array_Type (Typ) then - return Volatile_Or_Independent (Empty, Component_Type (Typ)); + if Volatile_Or_Independent (Empty, Component_Type (Typ)) then + return True; + end if; + elsif Is_Record_Type (Typ) then declare Comp : Entity_Id := First_Component (Typ); @@ -1688,7 +1691,6 @@ package body Exp_Ch5 is and then Is_Bit_Packed_Array (R_Type) and then not Reverse_Storage_Order (L_Type) and then not Reverse_Storage_Order (R_Type) - and then Ndim = 1 and then Slices and then not Slice_Of_Packed_Component (L) and then not Volatile_Or_Independent (L, L_Type) |