From ef4fd3572627f59b8787107632605835993f9a1c Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 7 Apr 2007 01:03:46 +0000 Subject: 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 --- lib/Transforms/IPO/SimplifyLibCalls.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'lib/Transforms/IPO/SimplifyLibCalls.cpp') diff --git a/lib/Transforms/IPO/SimplifyLibCalls.cpp b/lib/Transforms/IPO/SimplifyLibCalls.cpp index f1552eeb8c..96b5f3d77b 100644 --- a/lib/Transforms/IPO/SimplifyLibCalls.cpp +++ b/lib/Transforms/IPO/SimplifyLibCalls.cpp @@ -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(*UI); - if (ICmpInst *IC = dyn_cast(User)) { - if ((IC->getPredicate() == ICmpInst::ICMP_NE || - IC->getPredicate() == ICmpInst::ICMP_EQ) && - isa(IC->getOperand(1)) && - cast(IC->getOperand(1))->isNullValue()) - continue; - } else if (CastInst *CI = dyn_cast(User)) - if (CI->getType() == Type::Int1Ty) - continue; + if (ICmpInst *IC = dyn_cast(*UI)) + if (IC->isEquality()) + if (Constant *C = dyn_cast(IC->getOperand(1))) + if (C->isNullValue()) + continue; // Unknown instruction. return false; } -- cgit v1.2.3