diff options
author | Craig Topper <craig.topper@intel.com> | 2018-01-28 07:29:35 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@intel.com> | 2018-01-28 07:29:35 +0000 |
commit | 3913a4dd5665ee470ce602607623bfadc94da7c6 (patch) | |
tree | ee0e26ff75cb8665ca4a1b8326b7362965d6dd99 /llvm/lib | |
parent | 07d85e46fc0e8fa442c4b080ce84c28343b7f5d7 (diff) | |
download | bcm5719-llvm-3913a4dd5665ee470ce602607623bfadc94da7c6.tar.gz bcm5719-llvm-3913a4dd5665ee470ce602607623bfadc94da7c6.zip |
[X86] Fix a crash that can occur in combineExtractVectorElt due to not checking the width of a ConstantSDNode before calling getConstantOperandVal.
llvm-svn: 323614
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 4b1efab9430..a0ed2934fc4 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -31238,8 +31238,9 @@ static SDValue combineExtractVectorElt(SDNode *N, SelectionDAG &DAG, isa<ConstantSDNode>(EltIdx) && isa<ConstantSDNode>(InputVector.getOperand(0))) { uint64_t ExtractedElt = N->getConstantOperandVal(1); - uint64_t InputValue = InputVector.getConstantOperandVal(0); - uint64_t Res = (InputValue >> ExtractedElt) & 1; + auto *InputC = cast<ConstantSDNode>(InputVector.getOperand(0)); + const APInt &InputValue = InputC->getAPIntValue(); + uint64_t Res = InputValue[ExtractedElt]; return DAG.getConstant(Res, dl, MVT::i1); } |