mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-16 11:24:39 +00:00
trunc to bool no longer compares against zero
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35712 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -847,16 +847,11 @@ struct VISIBILITY_HIDDEN StrLenOptimization : public LibCallOptimization {
|
|||||||
static bool IsOnlyUsedInEqualsZeroComparison(Instruction *I) {
|
static bool IsOnlyUsedInEqualsZeroComparison(Instruction *I) {
|
||||||
for (Value::use_iterator UI = I->use_begin(), E = I->use_end();
|
for (Value::use_iterator UI = I->use_begin(), E = I->use_end();
|
||||||
UI != E; ++UI) {
|
UI != E; ++UI) {
|
||||||
Instruction *User = cast<Instruction>(*UI);
|
if (ICmpInst *IC = dyn_cast<ICmpInst>(*UI))
|
||||||
if (ICmpInst *IC = dyn_cast<ICmpInst>(User)) {
|
if (IC->isEquality())
|
||||||
if ((IC->getPredicate() == ICmpInst::ICMP_NE ||
|
if (Constant *C = dyn_cast<Constant>(IC->getOperand(1)))
|
||||||
IC->getPredicate() == ICmpInst::ICMP_EQ) &&
|
if (C->isNullValue())
|
||||||
isa<Constant>(IC->getOperand(1)) &&
|
continue;
|
||||||
cast<Constant>(IC->getOperand(1))->isNullValue())
|
|
||||||
continue;
|
|
||||||
} else if (CastInst *CI = dyn_cast<CastInst>(User))
|
|
||||||
if (CI->getType() == Type::Int1Ty)
|
|
||||||
continue;
|
|
||||||
// Unknown instruction.
|
// Unknown instruction.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user