diff options
author | Sanjay Patel <spatel@rotateright.com> | 2016-07-20 23:40:01 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2016-07-20 23:40:01 +0000 |
commit | 5f3c70307d7e195b802048a04e8c33c8b2ff6a50 (patch) | |
tree | ba8df2af9a032b241979c5741d47d76a4879eb3f /llvm/lib/Analysis/InstructionSimplify.cpp | |
parent | 192c4f1a4a129ae769577c23182352e8dd1ad62b (diff) | |
download | llvm-5f3c70307d7e195b802048a04e8c33c8b2ff6a50.zip llvm-5f3c70307d7e195b802048a04e8c33c8b2ff6a50.tar.gz llvm-5f3c70307d7e195b802048a04e8c33c8b2ff6a50.tar.bz2 |
[InstSimplify][InstCombine] don't crash when folding vector selects of icmp
Differential Revision: https://reviews.llvm.org/D22602
llvm-svn: 276209
Diffstat (limited to 'llvm/lib/Analysis/InstructionSimplify.cpp')
-rw-r--r-- | llvm/lib/Analysis/InstructionSimplify.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp index 9eefc99..45d4f14 100644 --- a/llvm/lib/Analysis/InstructionSimplify.cpp +++ b/llvm/lib/Analysis/InstructionSimplify.cpp @@ -3416,7 +3416,10 @@ static Value *simplifySelectWithICmpCond(Value *CondVal, Value *TrueVal, if (!match(CondVal, m_ICmp(Pred, m_Value(CmpLHS), m_Value(CmpRHS)))) return nullptr; - unsigned BitWidth = Q.DL.getTypeSizeInBits(TrueVal->getType()); + // FIXME: This code is nearly duplicated in InstCombine. Using/refactoring + // decomposeBitTestICmp() might help. + unsigned BitWidth = + Q.DL.getTypeSizeInBits(TrueVal->getType()->getScalarType()); APInt MinSignedValue = APInt::getSignBit(BitWidth); if (ICmpInst::isEquality(Pred) && match(CmpRHS, m_Zero())) { Value *X; |