public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-5026] [Ada] Simplify expansion of array equality
@ 2021-11-09 9:46 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-11-09 9:46 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:02ca2184cdabf79c8c8353b7d464f15d26d1f24f
commit r12-5026-g02ca2184cdabf79c8c8353b7d464f15d26d1f24f
Author: Piotr Trojanek <trojanek@adacore.com>
Date: Tue Oct 26 18:05:43 2021 +0200
[Ada] Simplify expansion of array equality
gcc/ada/
* exp_ch4.adb (Test_Empty_Arrays): Simplify with Evolve_Or_Else;
remove unnecessary call to Relocate_Node.
(Test_Lengths_Correspond): Likewise.
Diff:
---
gcc/ada/exp_ch4.adb | 50 +++++++++-----------------------------------------
1 file changed, 9 insertions(+), 41 deletions(-)
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 93dffb66011..26996444735 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -1902,41 +1902,20 @@ package body Exp_Ch4 is
-----------------------
function Test_Empty_Arrays return Node_Id is
- Alist : Node_Id;
- Blist : Node_Id;
-
- Atest : Node_Id;
- Btest : Node_Id;
+ Alist : Node_Id := Empty;
+ Blist : Node_Id := Empty;
begin
- Alist := Empty;
- Blist := Empty;
for J in 1 .. Number_Dimensions (Ltyp) loop
- Atest :=
+ Evolve_Or_Else (Alist,
Make_Op_Eq (Loc,
Left_Opnd => Arr_Attr (A, Name_Length, J),
- Right_Opnd => Make_Integer_Literal (Loc, 0));
+ Right_Opnd => Make_Integer_Literal (Loc, Uint_0)));
- Btest :=
+ Evolve_Or_Else (Blist,
Make_Op_Eq (Loc,
Left_Opnd => Arr_Attr (B, Name_Length, J),
- Right_Opnd => Make_Integer_Literal (Loc, 0));
-
- if No (Alist) then
- Alist := Atest;
- Blist := Btest;
-
- else
- Alist :=
- Make_Or_Else (Loc,
- Left_Opnd => Relocate_Node (Alist),
- Right_Opnd => Atest);
-
- Blist :=
- Make_Or_Else (Loc,
- Left_Opnd => Relocate_Node (Blist),
- Right_Opnd => Btest);
- end if;
+ Right_Opnd => Make_Integer_Literal (Loc, Uint_0)));
end loop;
return
@@ -1950,25 +1929,14 @@ package body Exp_Ch4 is
-----------------------------
function Test_Lengths_Correspond return Node_Id is
- Result : Node_Id;
- Rtest : Node_Id;
+ Result : Node_Id := Empty;
begin
- Result := Empty;
for J in 1 .. Number_Dimensions (Ltyp) loop
- Rtest :=
+ Evolve_Or_Else (Result,
Make_Op_Ne (Loc,
Left_Opnd => Arr_Attr (A, Name_Length, J),
- Right_Opnd => Arr_Attr (B, Name_Length, J));
-
- if No (Result) then
- Result := Rtest;
- else
- Result :=
- Make_Or_Else (Loc,
- Left_Opnd => Relocate_Node (Result),
- Right_Opnd => Rtest);
- end if;
+ Right_Opnd => Arr_Attr (B, Name_Length, J)));
end loop;
return Result;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-11-09 9:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-09 9:46 [gcc r12-5026] [Ada] Simplify expansion of array equality Pierre-Marie de Rodat
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).