trunc to bool no longer compares against zero

llvm-svn: 35712
This commit is contained in:
Chris Lattner 2007-04-07 01:03:46 +00:00
parent e8829aa9dd
commit 6a36d636e9
1 changed files with 5 additions and 10 deletions

View File

@ -847,16 +847,11 @@ struct VISIBILITY_HIDDEN StrLenOptimization : public LibCallOptimization {
static bool IsOnlyUsedInEqualsZeroComparison(Instruction *I) {
for (Value::use_iterator UI = I->use_begin(), E = I->use_end();
UI != E; ++UI) {
Instruction *User = cast<Instruction>(*UI);
if (ICmpInst *IC = dyn_cast<ICmpInst>(User)) {
if ((IC->getPredicate() == ICmpInst::ICMP_NE ||
IC->getPredicate() == ICmpInst::ICMP_EQ) &&
isa<Constant>(IC->getOperand(1)) &&
cast<Constant>(IC->getOperand(1))->isNullValue())
continue;
} else if (CastInst *CI = dyn_cast<CastInst>(User))
if (CI->getType() == Type::Int1Ty)
continue;
if (ICmpInst *IC = dyn_cast<ICmpInst>(*UI))
if (IC->isEquality())
if (Constant *C = dyn_cast<Constant>(IC->getOperand(1)))
if (C->isNullValue())
continue;
// Unknown instruction.
return false;
}