From: Arnaud Charlet Date: Mon, 11 Jun 2018 09:18:39 +0000 (+0000) Subject: [Ada] Simplify expansion of "and then" in CodePeer mode X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=63254915a9dc280e52f033da0fe40441727758c0;p=gcc.git [Ada] Simplify expansion of "and then" in CodePeer mode 2018-06-11 Arnaud Charlet gcc/ada/ * exp_ch4.adb (Expand_Record_Equality): Remove extraneous "True and then" and general logical "ada" in codepeer mode. From-SVN: r261418 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index cafac4fcf2a..97dbbf3f41d 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2018-06-11 Arnaud Charlet + + * exp_ch4.adb (Expand_Record_Equality): Remove extraneous "True and + then" and general logical "ada" in codepeer mode. + 2018-06-11 Javier Miranda * exp_ch9.adb (Expand_N_Protected_Body): Add missing handling of diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 0d836f85698..c29ba76f113 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -12154,12 +12154,11 @@ package body Exp_Ch4 is -- Generates the following code: (assuming that Typ has one Discr and -- component C2 is also a record) - -- True - -- and then Lhs.Discr1 = Rhs.Discr1 - -- and then Lhs.C1 = Rhs.C1 - -- and then Lhs.C2.C1=Rhs.C2.C1 and then ... Lhs.C2.Cn=Rhs.C2.Cn - -- and then ... - -- and then Lhs.Cmpn = Rhs.Cmpn + -- Lhs.Discr1 = Rhs.Discr1 + -- and then Lhs.C1 = Rhs.C1 + -- and then Lhs.C2.C1=Rhs.C2.C1 and then ... Lhs.C2.Cn=Rhs.C2.Cn + -- and then ... + -- and then Lhs.Cmpn = Rhs.Cmpn Result := New_Occurrence_Of (Standard_True, Loc); C := Element_To_Compare (First_Entity (Typ)); @@ -12171,7 +12170,6 @@ package body Exp_Ch4 is begin if First_Time then - First_Time := False; New_Lhs := Lhs; New_Rhs := Rhs; else @@ -12199,13 +12197,28 @@ package body Exp_Ch4 is Set_Etype (Result, Standard_Boolean); exit; else - Result := - Make_And_Then (Loc, - Left_Opnd => Result, - Right_Opnd => Check); + if First_Time then + Result := Check; + + -- Generate logical "and" for CodePeer to simplify the + -- generated code and analysis. + + elsif CodePeer_Mode then + Result := + Make_Op_And (Loc, + Left_Opnd => Result, + Right_Opnd => Check); + + else + Result := + Make_And_Then (Loc, + Left_Opnd => Result, + Right_Opnd => Check); + end if; end if; end; + First_Time := False; C := Element_To_Compare (Next_Entity (C)); end loop;