PR ipa/103601: ICE compiling CSiBE in ipa-modref's insert_kill.
authorRoger Sayle <roger@nextmovesoftware.com>
Fri, 10 Dec 2021 12:02:04 +0000 (12:02 +0000)
committerRoger Sayle <roger@nextmovesoftware.com>
Fri, 10 Dec 2021 12:02:04 +0000 (12:02 +0000)
commit2a1c3b69c015ea49e4c7c08291efd8f7e28e1193
tree8c2661d499fec25db3ef1d572049c06137afee33
parent4a87a8e4b13e979e7c8a626a8f4082715a48e21e
PR ipa/103601: ICE compiling CSiBE in ipa-modref's insert_kill.

This patch fixes PR ipa/103061 which is P1 regression that shows up as
an ICE in ipa-modref-tree.c's insert_kill when compiling the CSiBE
benchmark.  I believe the underlying cause is that the new kill tracking
functionality wasn't anticipating memory accesses that are zero bits
wide!?.  The failing source code (test case) contains the unusual lines:
typedef struct { } spinlock_t;
and
q->lock = (spinlock_t) { };
Making spinlock_t larger, or removing the assignment work around the issue.

The one line patch below to useful_for_kill_p teaches IPA that a memory
write is only useful as a "kill" if it is more than zero bits wide.
In theory, the existing known_size_p (size) test is now redundant, as
poly_int64 currently uses the value -1 for unknown size values,
but the proposed change makes the semantics clear, and defends against
possible future changes in representation.

2021-12-10  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
PR ipa/103601
* ipa-modref-tree.h (useful_for_kill_p): Zero width accesses aren't
useful for kill tracking.

gcc/testsuite/ChangeLog
PR ipa/103601
* gcc.dg/ipa/pr103601.c: New test case.
gcc/ipa-modref-tree.h
gcc/testsuite/gcc.dg/ipa/pr103601.c [new file with mode: 0644]