aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/Make-lang.in
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2019-09-19 08:13:29 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-09-19 08:13:29 +0000
commit1dd3915be108e6dcd7adfa01de6096419092a5de (patch)
tree42ffcfdfd44bf6e5926e9edee4bc052bc0357912 /gcc/ada/gcc-interface/Make-lang.in
parentc4f372c54f24fd24f1092fb6a09c31c7733ce8cc (diff)
downloadgcc-1dd3915be108e6dcd7adfa01de6096419092a5de.zip
gcc-1dd3915be108e6dcd7adfa01de6096419092a5de.tar.gz
gcc-1dd3915be108e6dcd7adfa01de6096419092a5de.tar.bz2
[Ada] Streamline comparison for equality of 2-element arrays
In the general case, the comparison for equality of array objects is implemented by a local function that contains, among other things, a loop running over the elements, comparing them one by one and exiting as soon as an element is not the same in the two array objects. For the specific case of constrained 2-element arrays, this is rather heavy and unnecessarily obfuscates the control flow of the program, so this change implements a simple conjunction of comparisons for it. Running these commands: gcc -c p.ads -O -gnatD grep loop p.ads.dg On the following sources: package P is type Rec is record Re : Float; Im : Float; end record; type Arr is array (1 .. 2) of Rec; function Equal (A, B : Arr) return Boolean is (A = B); end P; Should execute silently. 2019-09-19 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * exp_ch4.adb (Expand_Array_Equality): If optimization is enabled, generate a simple conjunction of comparisons for the specific case of constrained 1-dimensional 2-element arrays. Fix formatting. From-SVN: r275941
Diffstat (limited to 'gcc/ada/gcc-interface/Make-lang.in')
0 files changed, 0 insertions, 0 deletions