diff options
author | Craig Topper <craig.topper@gmail.com> | 2012-07-01 02:17:08 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2012-07-01 02:17:08 +0000 |
commit | 15d39adbcaf5e9e779e66ebd252502142c683e18 (patch) | |
tree | adf0dd5d128c2c4f77e376e03250f545b6ae6665 /lib/Target/X86/X86ISelDAGToDAG.cpp | |
parent | de6e484c15e71d4ed6a1ece3537daf78721d07a3 (diff) |
Fix a crash on release builds if gather intrinsics are passed a non-constant value for the last argument.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159501 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86ISelDAGToDAG.cpp')
-rw-r--r-- | lib/Target/X86/X86ISelDAGToDAG.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Target/X86/X86ISelDAGToDAG.cpp b/lib/Target/X86/X86ISelDAGToDAG.cpp index b34f15c34b..4a0271fd86 100644 --- a/lib/Target/X86/X86ISelDAGToDAG.cpp +++ b/lib/Target/X86/X86ISelDAGToDAG.cpp @@ -1963,7 +1963,8 @@ SDNode *X86DAGToDAGISel::SelectGather(SDNode *Node, unsigned Opc) { SDValue VIdx = Node->getOperand(4); SDValue VMask = Node->getOperand(5); ConstantSDNode *Scale = dyn_cast<ConstantSDNode>(Node->getOperand(6)); - assert(Scale && "Scale should be a constant for GATHER operations"); + if (!Scale) + return 0; // Memory Operands: Base, Scale, Index, Disp, Segment SDValue Disp = CurDAG->getTargetConstant(0, MVT::i32); @@ -2031,7 +2032,9 @@ SDNode *X86DAGToDAGISel::Select(SDNode *Node) { case Intrinsic::x86_avx2_gather_q_d: Opc = X86::VPGATHERQDrm; break; case Intrinsic::x86_avx2_gather_q_d_256: Opc = X86::VPGATHERQDYrm; break; } - return SelectGather(Node, Opc); + SDNode *RetVal = SelectGather(Node, Opc); + if (RetVal) + return RetVal; } } break; |