Fix incorrect TARGET_MEM_REF alignment (PR 84419)
commit0ea6d5cac3509cbbd1a09426836b50c9b858d040
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 20 Feb 2018 14:44:24 +0000 (20 14:44 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 20 Feb 2018 14:44:24 +0000 (20 14:44 +0000)
tree4876fe452ae7607c88e5357f95da7f998ac00588
parentd38b0287de8bb63655067fd1b26ab0f3478bce67
Fix incorrect TARGET_MEM_REF alignment (PR 84419)

expand_call_mem_ref checks for TARGET_MEM_REFs that have compatible
type, but it didn't then go on to install the specific type we need,
which might have different alignment due to:

  if (TYPE_ALIGN (type) != align)
    type = build_aligned_type (type, align);

This was causing masked stores to be incorrectly marked as
aligned on AVX512.

2018-02-20  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
PR tree-optimization/84419
* internal-fn.c (expand_call_mem_ref): Create a TARGET_MEM_REF
with the required type if its current type is compatible but
different.

gcc/testsuite/
PR tree-optimization/84419
* gcc.dg/vect/pr84419.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@257847 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/internal-fn.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/pr84419.c [new file with mode: 0644]