InstCombine: Fix a thinko where transform an icmp under the assumption that it's a zero comparison when it's not.

Fixes PR9454.

llvm-svn: 127464
This commit is contained in:
Benjamin Kramer
2011-03-11 11:37:40 +00:00
parent cc79973856
commit 51897bcd3e
2 changed files with 12 additions and 3 deletions

View File

@@ -503,9 +503,8 @@ static Value *foldSelectICmpAnd(const SelectInst &SI, ConstantInt *TrueVal,
if (!IC || !IC->isEquality())
return 0;
if (ConstantInt *C = dyn_cast<ConstantInt>(IC->getOperand(1)))
if (!C->isZero())
return 0;
if (!match(IC->getOperand(1), m_Zero()))
return 0;
ConstantInt *AndRHS;
Value *LHS = IC->getOperand(0);