From: Javier Miranda Date: Wed, 3 Jul 2019 08:13:29 +0000 (+0000) Subject: [Ada] Exp_Attr: remove dead code X-Git-Tag: upstream/12.2.0~23521 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4a51756a8c5536d6f7b9718d7eea39147fcd24d2;p=platform%2Fupstream%2Fgcc.git [Ada] Exp_Attr: remove dead code 2019-07-03 Javier Miranda gcc/ada/ * exp_attr.adb (Expand_Min_Max_Attribute): Code cleanup: removing code that it is now never executed in the CCG compiler (dead code). From-SVN: r272959 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 12fee98..6754011 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2019-07-03 Javier Miranda + + * exp_attr.adb (Expand_Min_Max_Attribute): Code cleanup: + removing code that it is now never executed in the CCG compiler + (dead code). + 2019-07-02 Iain Sandoe * libgnat/system-darwin-ppc.ads: Set Stack_Check_Probes True for diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb index 97e2671..1e1b2f9 100644 --- a/gcc/ada/exp_attr.adb +++ b/gcc/ada/exp_attr.adb @@ -1693,109 +1693,6 @@ package body Exp_Attr is -- generate conditionals in the code, so check the relevant restriction. Check_Restriction (No_Implicit_Conditionals, N); - - -- In Modify_Tree_For_C mode, we rewrite as an if expression (unless it - -- is supported). - - if Modify_Tree_For_C - and then not Is_Integer_Type (Etype (N)) - and then not Is_Enumeration_Type (Etype (N)) - and then not Is_Fixed_Point_Type (Etype (N)) - and then not Is_Floating_Point_Type (Etype (N)) - then - declare - Loc : constant Source_Ptr := Sloc (N); - Typ : constant Entity_Id := Etype (N); - Expr : constant Node_Id := First (Expressions (N)); - Left : constant Node_Id := Relocate_Node (Expr); - Right : constant Node_Id := Relocate_Node (Next (Expr)); - - function Make_Compare (Left, Right : Node_Id) return Node_Id; - -- Returns Left >= Right for Max, Left <= Right for Min - - ------------------ - -- Make_Compare -- - ------------------ - - function Make_Compare (Left, Right : Node_Id) return Node_Id is - begin - if Attribute_Name (N) = Name_Max then - return - Make_Op_Ge (Loc, - Left_Opnd => Left, - Right_Opnd => Right); - else - return - Make_Op_Le (Loc, - Left_Opnd => Left, - Right_Opnd => Right); - end if; - end Make_Compare; - - -- Start of processing for Min_Max - - begin - -- If both Left and Right are side effect free, then we can just - -- use Duplicate_Expr to duplicate the references and return - - -- (if Left >=|<= Right then Left else Right) - - if Side_Effect_Free (Left) and then Side_Effect_Free (Right) then - Rewrite (N, - Make_If_Expression (Loc, - Expressions => New_List ( - Make_Compare (Left, Right), - Duplicate_Subexpr_No_Checks (Left), - Duplicate_Subexpr_No_Checks (Right)))); - - -- Otherwise we generate declarations to capture the values. - - -- The translation is - - -- do - -- T1 : constant typ := Left; - -- T2 : constant typ := Right; - -- in - -- (if T1 >=|<= T2 then T1 else T2) - -- end; - - else - declare - T1 : constant Entity_Id := Make_Temporary (Loc, 'T', Left); - T2 : constant Entity_Id := Make_Temporary (Loc, 'T', Right); - - begin - Rewrite (N, - Make_Expression_With_Actions (Loc, - Actions => New_List ( - Make_Object_Declaration (Loc, - Defining_Identifier => T1, - Constant_Present => True, - Object_Definition => - New_Occurrence_Of (Etype (Left), Loc), - Expression => Relocate_Node (Left)), - - Make_Object_Declaration (Loc, - Defining_Identifier => T2, - Constant_Present => True, - Object_Definition => - New_Occurrence_Of (Etype (Right), Loc), - Expression => Relocate_Node (Right))), - - Expression => - Make_If_Expression (Loc, - Expressions => New_List ( - Make_Compare - (New_Occurrence_Of (T1, Loc), - New_Occurrence_Of (T2, Loc)), - New_Occurrence_Of (T1, Loc), - New_Occurrence_Of (T2, Loc))))); - end; - end if; - - Analyze_And_Resolve (N, Typ); - end; - end if; end Expand_Min_Max_Attribute; ----------------------------------