diff options
Diffstat (limited to 'gcc/ada/exp_ch9.adb')
-rw-r--r-- | gcc/ada/exp_ch9.adb | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb index 5dcd890..cfdab11 100644 --- a/gcc/ada/exp_ch9.adb +++ b/gcc/ada/exp_ch9.adb @@ -6124,7 +6124,6 @@ package body Exp_Ch9 is -- Local variables - Cond_Id : Entity_Id; Entry_Body : Node_Id; Func_Body : Node_Id := Empty; @@ -6191,30 +6190,21 @@ package body Exp_Ch9 is Check_Unprotected_Barrier (Cond); end if; - if Is_Entity_Name (Cond) then - Cond_Id := Entity (Cond); + -- Perform a small optimization of simple barrier functions. If the + -- scope of the condition's entity is not the barrier function, then + -- the condition does not depend on any of the generated renamings. + -- If this is the case, eliminate the renamings as they are useless. + -- This optimization is not performed when the condition was folded + -- and validity checks are in effect because the original condition + -- may have produced at least one check that depends on the generated + -- renamings. - -- Perform a small optimization of simple barrier functions. If the - -- scope of the condition's entity is not the barrier function, then - -- the condition does not depend on any of the generated renamings. - -- If this is the case, eliminate the renamings as they are useless. - -- This optimization is not performed when the condition was folded - -- and validity checks are in effect because the original condition - -- may have produced at least one check that depends on the generated - -- renamings. - - if Expander_Active - and then Scope (Cond_Id) /= Func_Id - and then not Validity_Check_Operands - then - Set_Declarations (Func_Body, Empty_List); - end if; - - -- Note that after analysis variables in this context will be - -- replaced by the corresponding prival, that is to say a renaming - -- of a selected component of the form _Object.Var. If expansion is - -- disabled, as within a generic, we check that the entity appears in - -- the current scope. + if Expander_Active + and then Is_Entity_Name (Cond) + and then Scope (Entity (Cond)) /= Func_Id + and then not Validity_Check_Operands + then + Set_Declarations (Func_Body, Empty_List); end if; end Expand_Entry_Barrier; |