a zero value is the most likely way to cause further simplification, so we do it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12197
91177308-0d34-0410-b5e6-
96231b3b80d8
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();