OSDN Git Service

[X86] Custom legalize v2i32 gathers via widening rather than promoting.
authorCraig Topper <craig.topper@intel.com>
Fri, 1 Dec 2017 06:02:02 +0000 (06:02 +0000)
committerCraig Topper <craig.topper@intel.com>
Fri, 1 Dec 2017 06:02:02 +0000 (06:02 +0000)
commitbf6769b8051e87200923dc11f01957ecd868da81
tree53b01778a04383b61000a0ebd01ec1e8e5ec4d13
parent6f57cb50262b014c77eb31e3c0b2a669a2e4b9cf
[X86] Custom legalize v2i32 gathers via widening rather than promoting.

The default legalization for v2i32 is promotion to v2i64. This results in a gather that reads 64-bit elements rather than 32. If one of the elements is near a page boundary this can cause an illegal access that can fault.

We also miscalculate the scale for the gather which is an even worse problem, but we probably could have found a separate way to fix that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319521 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/avx2-masked-gather.ll
test/CodeGen/X86/masked_gather_scatter.ll