[llvm-commits] CVS: llvm/lib/Transforms/Scalar/SCCP.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sun Mar 7 20:54:49 PST 2004
Changes in directory llvm/lib/Transforms/Scalar:
SCCP.cpp updated: 1.89 -> 1.90
---
Log message:
Since 'load null' is undefined, we can make it do whatever we want. Returning
a zero value is the most likely way to cause further simplification, so we do it.
---
Diffs of the changes: (+6 -0)
Index: llvm/lib/Transforms/Scalar/SCCP.cpp
diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.89 llvm/lib/Transforms/Scalar/SCCP.cpp:1.90
--- llvm/lib/Transforms/Scalar/SCCP.cpp:1.89 Sat Feb 14 23:55:10 2004
+++ llvm/lib/Transforms/Scalar/SCCP.cpp Sun Mar 7 16:16:24 2004
@@ -713,6 +713,12 @@
if (PtrVal.isUndefined()) return; // The pointer is not resolved yet!
if (PtrVal.isConstant() && !I.isVolatile()) {
Value *Ptr = PtrVal.getConstant();
+ if (isa<ConstantPointerNull>(Ptr)) {
+ // load null -> null
+ markConstant(IV, &I, Constant::getNullValue(I.getType()));
+ return;
+ }
+
if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(Ptr))
Ptr = CPR->getValue();
More information about the llvm-commits
mailing list