tidy up some stuff duncan pointed out.
authorChris Lattner <sabre@nondot.org>
Fri, 8 Jan 2010 17:48:19 +0000 (17:48 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 8 Jan 2010 17:48:19 +0000 (17:48 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93007 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/InstCombine/InstCombineCompares.cpp

index abbc89b0a104a5924523c296ebc19a9450b9f9b0..e59406c636ac512447113ecf674276b2cd85e2fe 100644 (file)
@@ -705,7 +705,7 @@ Instruction *InstCombiner::FoldICmpAddOpCst(ICmpInst &ICI,
   // so the values can never be equal.  Similiarly for all other "or equals"
   // operators.
   
-  // (X+1) <u X        --> X >u (MAXUINT-1)        --> X != 255
+  // (X+1) <u X        --> X >u (MAXUINT-1)        --> X == 255
   // (X+2) <u X        --> X >u (MAXUINT-2)        --> X > 253
   // (X+MAXUINT) <u X  --> X >u (MAXUINT-MAXUINT)  --> X != 0
   if (Pred == ICmpInst::ICMP_ULT || Pred == ICmpInst::ICMP_ULE) {
@@ -713,7 +713,8 @@ Instruction *InstCombiner::FoldICmpAddOpCst(ICmpInst &ICI,
     if (isNUW)
       return ReplaceInstUsesWith(ICI, ConstantInt::getFalse(X->getContext())); 
     
-    Value *R = ConstantExpr::getSub(ConstantInt::get(CI->getType(), -1ULL), CI);
+    Value *R = 
+      ConstantExpr::getSub(ConstantInt::getAllOnesValue(CI->getType()), CI);
     return new ICmpInst(ICmpInst::ICMP_UGT, X, R);
   }