[llvm-commits] CVS: llvm/lib/VMCore/Function.cpp

Chris Lattner sabre at nondot.org
Tue Apr 24 22:49:28 PDT 2007



Changes in directory llvm/lib/VMCore:

Function.cpp updated: 1.126 -> 1.127
---
Log message:

simplify some code


---
Diffs of the changes:  (+2 -5)

 Function.cpp |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)


Index: llvm/lib/VMCore/Function.cpp
diff -u llvm/lib/VMCore/Function.cpp:1.126 llvm/lib/VMCore/Function.cpp:1.127
--- llvm/lib/VMCore/Function.cpp:1.126	Sun Apr 22 12:28:03 2007
+++ llvm/lib/VMCore/Function.cpp	Wed Apr 25 00:49:09 2007
@@ -307,11 +307,8 @@
     if (isa<PointerType>(CI->getOperand(0)->getType()))
       return StripPointerCasts(CI->getOperand(0));
   } else if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(Ptr)) {
-    for (unsigned i = 1, e = GEP->getNumOperands(); i != e; ++i)
-      if (!isa<Constant>(GEP->getOperand(i)) ||
-          !cast<Constant>(GEP->getOperand(i))->isNullValue())
-        return Ptr;
-    return StripPointerCasts(GEP->getOperand(0));
+    if (GEP->hasAllZeroIndices())
+      return StripPointerCasts(GEP->getOperand(0));
   }
   return Ptr;
 }






More information about the llvm-commits mailing list