X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=lib%2FAnalysis%2FInstructionSimplify.cpp;h=56e7a094976e0a1b935b2f5115ed569b1456e3b5;hp=7d8b668be037e45fb97ba45e832f3d9252768713;hb=821c6f765adbc3079a21ad91d10726cbf8c4cb1b;hpb=f666c0549eaa6103a14ba4a9c57772942d0b6f1a diff --git a/lib/Analysis/InstructionSimplify.cpp b/lib/Analysis/InstructionSimplify.cpp index 7d8b668be03..56e7a094976 100644 --- a/lib/Analysis/InstructionSimplify.cpp +++ b/lib/Analysis/InstructionSimplify.cpp @@ -3152,14 +3152,15 @@ static Value *SimplifySelectInst(Value *CondVal, Value *TrueVal, if (isa(FalseVal)) // select C, X, undef -> X return TrueVal; - if (const auto *ICI = dyn_cast(CondVal)) { + const auto *ICI = dyn_cast(CondVal); + unsigned BitWidth = TrueVal->getType()->getScalarSizeInBits(); + if (ICI && BitWidth) { ICmpInst::Predicate Pred = ICI->getPredicate(); - APInt MinSignedValue = - APInt::getSignBit(TrueVal->getType()->getScalarSizeInBits()); + APInt MinSignedValue = APInt::getSignBit(BitWidth); Value *X; const APInt *Y; - bool IsBitTest = false; bool TrueWhenUnset; + bool IsBitTest = false; if (ICmpInst::isEquality(Pred) && match(ICI->getOperand(0), m_And(m_Value(X), m_APInt(Y))) && match(ICI->getOperand(1), m_Zero())) {