https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70189
Bug ID: 70189 Summary: Combine constant-pool logic from gimplify + SRA Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: alalaw01 at gcc dot gnu.org Target Milestone: --- Following PR/63679 (r232506), gimplify.c (gimplify_init_constructor) uses lots of heuristics to choose between pushing initializers out to the constant pool (by calling tree_output_constant_def) or outputting many elementwise statements. Then, in tree-sra.c (analyze_all_variable_accesses), we use more heuristics to decide which constant-pool loads to completely_scalarize, turning those back into elementwise statements. (These get pulled back in from the constant pool and the constant-pool entry deleted.) Both of these sets of heuristics are platform dependent (gimplify.c uses can_move_by_pieces, CLEAR_RATIO; tree-sra.c uses get_move_ratio). Instead we should put all this logic in one place; this would make it clearer, and we'd probably get better overall decisions. The suggestion is for gimplify.c to always push out to the constant pool, as this makes initial tree the same on all platforms, and for all the logic/heuristics to go into SRA (as, being later, we then have more information available to maybe make better decisions in the future).