indvars: drive by heuristics fix.
authorAndrew Trick <atrick@apple.com>
Wed, 18 Jul 2012 04:35:13 +0000 (04:35 +0000)
committerAndrew Trick <atrick@apple.com>
Wed, 18 Jul 2012 04:35:13 +0000 (04:35 +0000)
Minor oversight noticed by inspection. Sorry no unit test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160422 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/IndVarSimplify.cpp

index 4b5c84ca6cea13b268a154a3179bf968a10465a7..37f8bdfbffed9fb967143d360552be7a31cc1118 100644 (file)
@@ -1409,7 +1409,7 @@ FindLoopCounter(Loop *L, const SCEV *BECount,
       // If two IVs both count from zero or both count from nonzero then the
       // narrower is likely a dead phi that has been widened. Use the wider phi
       // to allow the other to be eliminated.
-      if (PhiWidth <= SE->getTypeSizeInBits(BestPhi->getType()))
+      else if (PhiWidth <= SE->getTypeSizeInBits(BestPhi->getType()))
         continue;
     }
     BestPhi = Phi;