Hi, In PR78561, we try to make use of stale constant pool offset data when making decisions as to whether to output an alignment directive after the AArch64 constant pool. The offset data goes stale as we only ever increment it when adding new constants to the pool (it represents an upper bound on the size of the pool).
To fix that, we should recompute the offset values shortly after sweeping through insns looking for valid constant. That's easy enough to do (see patch 2/2) and patch 1/2 is just a simple rename of the get_pool_size function to reflect that it is not providing an accurate size, just an upper bound on what the size might be after optimisation. Technically, patch 1/2 isn't neccessary to fix the PR but cleaning up the name seems like a useful to do. The patch set has been bootstrapped and tested on aarch64-none-linux-gnu and x86-64-none-linux-gnu without any issues. I've also cross-tested it for aarch64-none-elf and build-tested it for rs6000 (though I couldn't run the testsuite as I don't have a test environment). OK? Thanks, James --- [Patch 1/2 PR78561] Rename get_pool_size to get_pool_size_upper_bound gcc/ 2016-12-01 James Greenhalgh <james.greenha...@arm.com> PR rtl-optimization/78561 * config/rs6000/rs6000.c (rs6000_reg_live_or_pic_offset_p) Rename get_pool_size to get_pool_size_upper_bound. (rs6000_stack_info): Likewise. (rs6000_emit_prologue): Likewise. (rs6000_elf_declare_function_name): Likewise. (rs6000_set_up_by_prologue): Likewise. (rs6000_can_eliminate): Likewise, reformat spaces to tabs. * output.h (get_pool_size): Rename to... (get_pool_size_upper_bound): ...This. * varasm.c (get_pool_size): Rename to... (get_pool_size_upper_bound): ...This. [Patch 2/2 PR78561] Recalculate constant pool size before emitting it gcc/ 2016-12-01 James Greenhalgh <james.greenha...@arm.com> PR rtl-optimization/78561 * varasm.c (recompute_pool_offsets): New. (output_constant_pool): Call it. gcc/testsuite/ 2016-12-01 James Greenhalgh <james.greenha...@arm.com> PR rtl-optimization/78561 * gcc.target/aarch64/pr78561.c: New. --- gcc/config/rs6000/rs6000.c | 23 +++++++++++++---------- gcc/output.h | 7 +++++-- gcc/testsuite/gcc.target/aarch64/pr78561.c | 9 +++++++++ gcc/varasm.c | 30 +++++++++++++++++++++++++++++- 4 files changed, 56 insertions(+), 13 deletions(-) create mode 100644 gcc/testsuite/gcc.target/aarch64/pr78561.c