[llvm-commits] [llvm] r136757 - /llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp

Nick Lewycky nicholas at mxc.ca
Tue Aug 2 18:11:40 PDT 2011


Author: nicholas
Date: Tue Aug  2 20:11:40 2011
New Revision: 136757

URL: http://llvm.org/viewvc/llvm-project?rev=136757&view=rev
Log:
Small cleanups:
  - use SmallVectorImpl& for the function argument.
  - ignore the operands on the GEP, even if they aren't constant! Much as we
    pretend the malloc succeeds, we pretend that malloc + whatever-you-GEP'd-by
    is not null. It's magic!

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

Modified: llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp?rev=136757&r1=136756&r2=136757&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp Tue Aug  2 20:11:40 2011
@@ -1044,7 +1044,7 @@
 
 
 
-static bool IsOnlyNullComparedAndFreed(Value *V, SmallVector<WeakVH, 64> &Users,
+static bool IsOnlyNullComparedAndFreed(Value *V, SmallVectorImpl<WeakVH> &Users,
                                        int Depth = 0) {
   if (Depth == 8)
     return false;
@@ -1069,8 +1069,7 @@
       }
     }
     if (GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(U)) {
-      if (GEPI->hasAllZeroIndices() &&
-          IsOnlyNullComparedAndFreed(GEPI, Users, Depth+1)) {
+      if (IsOnlyNullComparedAndFreed(GEPI, Users, Depth+1)) {
         Users.push_back(GEPI);
         continue;
       }





More information about the llvm-commits mailing list