> Hmm, the patch looks obvious if it was the intent to allow constant > pool replacements > _not_ only when the whole constant pool entry may go away. But I > think the intent was > to not do this otherwise it will generate worse code by forcing all > loads from the constant pool to appear at > function start.
Do you mean when the whole constant pool entry is scalarized as opposed to partially scalarized? > So - the "real" issue may be a missing > should_scalarize_away_bitmap/cannot_scalarize_away_bitmap > check somewhere. This seems to work: Index: tree-sra.c =================================================================== --- tree-sra.c (revision 236195) +++ tree-sra.c (working copy) @@ -2680,6 +2680,10 @@ analyze_all_variable_accesses (void) EXECUTE_IF_SET_IN_BITMAP (tmp, 0, i, bi) { tree var = candidate (i); + if (constant_decl_p (var) + && (!bitmap_bit_p (should_scalarize_away_bitmap, i) + || bitmap_bit_p (cannot_scalarize_away_bitmap, i))) + continue; struct access *access; access = sort_and_splice_var_accesses (var); but I have no idea whether this is correct or not. Martin, are we sure to disable scalarization of constant_decl_p variables not covered by initialize_constant_pool_replacements that way? -- Eric Botcazou