[Patch PR78561 PowerPC] Revert to old behaviour for counting constant pools

James Greenhalgh james.greenhalgh@arm.com
Wed Dec 7 10:31:00 GMT 2016


Hi,

This patch is a bit of a shot in the dark, as I've been unable to reproduce
Segher's failures reported in the PR. But, he has confirmed on the PR that
this patch fixes the issue he was seeing.

Before my patch set, rs6000 was reading the size of the constant pool at
several points in compilation, and expecting that if it read non-zero at one
point in compilation, it would always read non-zero.

That doesn't hold if we recompute the size of the constant pool just before
emitting it and decide that actually the size is zero. That can mean some
of the preparation statements emitted early in the PowerPC back end can think
a constant pool is needed, while later passes know there won't be one as all
the references are unused. That then causes issues for PIC register set up.

We always keep the entries in the constant pool after we first see them, and
we figure out what gets used in the constant pool by sweeping through
looking for referenced entries. That means we can always answer the
question "has the constant pool ever had entries?" by checking if there
is anything at all in there.

So that's what this patch does.

Bootstrapped on gcc110 (powerpc64-none-linux-gnu) configured with
--enable-languages=all,ada,go,obj-c++ with no issues, Segher has also
tested it with no issues, and I've tested an aarch64-none-elf cross
compiler to ensure that the original fix still works on AArch64.

OK?

Thanks,
James

---
2016-12-07  James Greenhalgh  <james.greenhalgh@arm.com>

	PR rtl-optimization/78561
	* config/rs6000/rs6000.c (rs6000_reg_live_or_pic_offset_p) Use
	constant_pool_empty_p in place of 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.
	* output.h (get_pool_size_upper_bound): Delete.
	(constant_pool_empty_p): New.
	* varasm.c (get_pool_size_upper_bound): Delete
	(constant_pool_empty_p): New.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Patch-PR78561-PowerPC-Revert-to-old-behaviour-for-co.patch
Type: text/x-patch
Size: 4263 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20161207/aa51f9ec/attachment.bin>


More information about the Gcc-patches mailing list