[X86] Don't remove sign extend of gather/scatter indices during SelectionDAGBuilder.
authorCraig Topper <craig.topper@intel.com>
Thu, 16 Nov 2017 23:08:57 +0000 (23:08 +0000)
committerCraig Topper <craig.topper@intel.com>
Thu, 16 Nov 2017 23:08:57 +0000 (23:08 +0000)
commit242374e2197fb96143eb8ed8b64c55ec444d81e8
treea1a24800a16940faa725827423eab1f669d63820
parent12615ec49b745b0ed1ccacd1fa4d13d23d10751f
[X86] Don't remove sign extend of gather/scatter indices during SelectionDAGBuilder.

The sign extend might be from an i16 or i8 type and was inserted by InstCombine to match the pointer width. X86 gather legalization isn't currently detecting this to reinsert a sign extend to make things legal.

It's a bit weird for the SelectionDAGBuilder to do this kind of optimization in the first place. With this removed we can at least lean on InstCombine somewhat to ensure the index is i32 or i64.

I'll work on trying to recover some of the test cases by removing sign extends in the backend when its safe to do so with an understanding of the current legalizer capabilities.

This should fix PR30690.

llvm-svn: 318466
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/test/CodeGen/X86/masked_gather_scatter.ll