Fix DSE big-endian subreg crash on AArch64.
commitb65055ed7a648cb900b9880430a39e04016f5798
authortnfchris <tnfchris@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 21 Aug 2018 09:55:07 +0000 (21 09:55 +0000)
committertnfchris <tnfchris@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 21 Aug 2018 09:55:07 +0000 (21 09:55 +0000)
tree12d634187fcdcecf0de83dafe2f8355dc44386b8
parent88a179e20e7f44e11e5603f931ed1c26776a4529
Fix DSE big-endian subreg crash on AArch64.

This patch fixes an ICE that would happen when extract_low_bits
is called with modes for which you can't extract a valid subreg.
e.g. taking a 32 bytes subreg from a 48 byte mode.

The ICE happens because convert_modes which eventually calls
simplify_gen_subreg does not expect the convertion to fail.

The assert in gen_lowpart_general would then be hit.  The patch
changes it to validate the subreg before trying to convert the
modes.  If the subreg is not possible we return NULL_RTX and bail
out early.

gcc/ChangeLog:

2018-08-21  Tamar Christina  <tamar.christina@arm.com>

* expmed.c (extract_low_bits): Reject invalid subregs early.

gcc/testsuite/ChangeLog:

2018-08-21  Tamar Christina  <tamar.christina@arm.com>

* gcc.target/aarch64/large_struct_copy.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@263696 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/expmed.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/aarch64/large_struct_copy.c [new file with mode: 0644]