[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Feb 27 22:58:00 PST 2004


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.166 -> 1.167

---
Log message:

Turn 'free null' into nothing


---
Diffs of the changes:  (+8 -0)

Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.166 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.167
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.166	Fri Feb 27 00:27:46 2004
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Fri Feb 27 22:57:37 2004
@@ -2287,6 +2287,14 @@
       return &FI;
     }
 
+  // If we have 'free null' delete the instruction.  This can happen in stl code
+  // when lots of inlining happens.
+  if (isa<ConstantPointerNull>(Op)) {
+    FI.getParent()->getInstList().erase(&FI);
+    removeFromWorkList(&FI);
+    return 0;  // Don't do anything with FI
+  }
+
   return 0;
 }
 





More information about the llvm-commits mailing list