[Ada] Better code generation for nested aggregates

Message ID 20200608080043.GA90331@adacore.com
State New
Headers show
Series
  • [Ada] Better code generation for nested aggregates
Related show

Commit Message

Pierre-Marie de Rodat June 8, 2020, 8 a.m.
For aggregate components that are aggregates the frontend has been
enhanced to evaluate if the inner aggregate depends on the variable
being assigned to. This enhancement allows the compiler to avoid the
generation of a temporary and thus generate better code for large nested
aggregates.

Tested on x86_64-pc-linux-gnu, committed on trunk

2020-06-08  Javier Miranda  <miranda@adacore.com>

gcc/ada/

	* exp_aggr.adb (Safe_Component): Remove code that considers as
	unsafe components that are aggregates; such removal allows the
	frontend to proceed and evaluate if they are safe by means of
	invoking Safe_Aggregate.

Patch

--- gcc/ada/exp_aggr.adb
+++ gcc/ada/exp_aggr.adb
@@ -4283,11 +4283,6 @@  package body Exp_Aggr is
             if Is_Overloaded (Expr) then
                return False;
 
-            elsif Nkind (Expr) = N_Aggregate
-               and then not Is_Others_Aggregate (Expr)
-            then
-               return False;
-
             elsif Nkind (Expr) = N_Allocator then
 
                --  For now, too complex to analyze