aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/InstructionSimplify.cpp
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2016-07-20 23:40:01 +0000
committerSanjay Patel <spatel@rotateright.com>2016-07-20 23:40:01 +0000
commit5f3c70307d7e195b802048a04e8c33c8b2ff6a50 (patch)
treeba8df2af9a032b241979c5741d47d76a4879eb3f /llvm/lib/Analysis/InstructionSimplify.cpp
parent192c4f1a4a129ae769577c23182352e8dd1ad62b (diff)
downloadllvm-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.cpp5
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;