[llvm-commits] [llvm] r156069 - /llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp

Nuno Lopes nunoplopes at sapo.pt
Thu May 3 09:06:07 PDT 2012


Author: nlopes
Date: Thu May  3 11:06:07 2012
New Revision: 156069

URL: http://llvm.org/viewvc/llvm-project?rev=156069&view=rev
Log:
replace 'break's with 'return 0' in visitCallInst code for objectsize, since there is no need to fallback to visitCallSite.
This gives a 0.9% in a test case

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

Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp?rev=156069&r1=156068&r2=156069&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp Thu May  3 11:06:07 2012
@@ -247,7 +247,7 @@
   default: break;
   case Intrinsic::objectsize: {
     // We need target data for just about everything so depend on it.
-    if (!TD) break;
+    if (!TD) return 0;
 
     Type *ReturnTy = CI.getType();
     uint64_t DontKnow = II->getArgOperand(1) == Builder->getTrue() ? 0 : -1ULL;
@@ -260,7 +260,7 @@
 
     // Try to look through constant GEPs.
     if (GEPOperator *GEP = dyn_cast<GEPOperator>(Op1)) {
-      if (!GEP->hasAllConstantIndices()) break;
+      if (!GEP->hasAllConstantIndices()) return 0;
 
       // Get the current byte offset into the thing. Use the original
       // operand in case we're looking through a bitcast.
@@ -274,7 +274,7 @@
       // Make sure we're not a constant offset from an external
       // global.
       if (GlobalVariable *GV = dyn_cast<GlobalVariable>(Op1))
-        if (!GV->hasDefinitiveInitializer()) break;
+        if (!GV->hasDefinitiveInitializer()) return 0;
     }
 
     // If we've stripped down to a single global variable that we
@@ -294,7 +294,7 @@
         Size = TD->getTypeAllocSize(AI->getAllocatedType());
         if (AI->isArrayAllocation()) {
           const ConstantInt *C = dyn_cast<ConstantInt>(AI->getArraySize());
-          if (!C) break;
+          if (!C) return 0;
           Size *= C->getZExtValue();
         }
       }
@@ -310,7 +310,7 @@
     // Do not return "I don't know" here. Later optimization passes could
     // make it possible to evaluate objectsize to a constant.
     if (Size == -1ULL)
-      break;
+      return 0;
 
     if (Size < Offset) {
       // Out of bound reference? Negative index normalized to large





More information about the llvm-commits mailing list