[llvm-commits] [llvm] r125409 - /llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp

Chris Lattner sabre at nondot.org
Fri Feb 11 13:37:43 PST 2011


Author: lattner
Date: Fri Feb 11 15:37:43 2011
New Revision: 125409

URL: http://llvm.org/viewvc/llvm-project?rev=125409&view=rev
Log:
When lowering an inbounds gep, the intermediate adds can have
unsigned overflow (e.g. due to a negative array index), but
the scales on array size multiplications are known to not
sign wrap.

Modified:
    llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp

Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp?rev=125409&r1=125408&r2=125409&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp Fri Feb 11 15:37:43 2011
@@ -420,8 +420,7 @@
         
         if (Size)
           Result = Builder->CreateAdd(Result, ConstantInt::get(IntPtrTy, Size),
-                                      GEP->getName()+".offs",
-                                      isInBounds /*NUW*/);
+                                      GEP->getName()+".offs");
         continue;
       }
       
@@ -430,8 +429,7 @@
               ConstantExpr::getIntegerCast(OpC, IntPtrTy, true /*SExt*/);
       Scale = ConstantExpr::getMul(OC, Scale, isInBounds/*NUW*/);
       // Emit an add instruction.
-      Result = Builder->CreateAdd(Result, Scale, GEP->getName()+".offs",
-                                  isInBounds /*NUW*/);
+      Result = Builder->CreateAdd(Result, Scale, GEP->getName()+".offs");
       continue;
     }
     // Convert to correct type.
@@ -444,8 +442,7 @@
     }
 
     // Emit an add instruction.
-    Result = Builder->CreateAdd(Op, Result, GEP->getName()+".offs",
-                                isInBounds /*NUW*/);
+    Result = Builder->CreateAdd(Op, Result, GEP->getName()+".offs");
   }
   return Result;
 }





More information about the llvm-commits mailing list