Simplify this code, no functionality change.
authorNick Lewycky <nicholas@mxc.ca>
Thu, 21 Feb 2008 09:14:53 +0000 (09:14 +0000)
committerNick Lewycky <nicholas@mxc.ca>
Thu, 21 Feb 2008 09:14:53 +0000 (09:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47434 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/ScalarEvolution.cpp

index 827b1c02f02ed0f3c44f62b09ec879241be9a13b..876ebd474b3380cabe769cfe4505a945ebd50d39 100644 (file)
@@ -2600,11 +2600,8 @@ SCEVHandle ScalarEvolutionsImpl::HowFarToNonZero(SCEV *V, const Loop *L) {
   // If the value is a constant, check to see if it is known to be non-zero
   // already.  If so, the backedge will execute zero times.
   if (SCEVConstant *C = dyn_cast<SCEVConstant>(V)) {
-    Constant *Zero = Constant::getNullValue(C->getValue()->getType());
-    Constant *NonZero = 
-      ConstantExpr::getICmp(ICmpInst::ICMP_NE, C->getValue(), Zero);
-    if (NonZero == ConstantInt::getTrue())
-      return getSCEV(Zero);
+    if (!C->getValue()->isNullValue())
+      return SE.getIntegerSCEV(0, C->getType());
     return UnknownValue;  // Otherwise it will loop infinitely.
   }