diff options
author | David Majnemer <david.majnemer@gmail.com> | 2016-01-07 19:25:39 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2016-01-07 19:25:39 +0000 |
commit | bae945735ad21acc3797bd8f6e9b69c20f43b3ce (patch) | |
tree | 3103072d7dee6d25ef6702f3d4067c166f2057e5 /llvm/lib | |
parent | 45029d16771bc3ec0a24878deb05169cb02ed95b (diff) | |
download | bcm5719-llvm-bae945735ad21acc3797bd8f6e9b69c20f43b3ce.tar.gz bcm5719-llvm-bae945735ad21acc3797bd8f6e9b69c20f43b3ce.zip |
[SCCP] Can't go from overdefined to constant
The fix for PR23999 made us mark loads of null as producing the constant
undef which upsets the lattice. Instead, keep the load as "undefined".
This fixes PR26044.
llvm-svn: 257087
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/Scalar/SCCP.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/SCCP.cpp b/llvm/lib/Transforms/Scalar/SCCP.cpp index 2fca803adde..c5e2e9f3f79 100644 --- a/llvm/lib/Transforms/Scalar/SCCP.cpp +++ b/llvm/lib/Transforms/Scalar/SCCP.cpp @@ -1047,7 +1047,7 @@ void SCCPSolver::visitStoreInst(StoreInst &SI) { // global, we can replace the load with the loaded constant value! void SCCPSolver::visitLoadInst(LoadInst &I) { // If this load is of a struct, just mark the result overdefined. - if (I.getType()->isStructTy()) + if (I.getType()->isStructTy() || I.getType()->isMMXTy()) return markAnythingOverdefined(&I); LatticeVal PtrVal = getValueState(I.getOperand(0)); @@ -1061,9 +1061,9 @@ void SCCPSolver::visitLoadInst(LoadInst &I) { Constant *Ptr = PtrVal.getConstant(); - // load null -> null + // load null is undefined. if (isa<ConstantPointerNull>(Ptr) && I.getPointerAddressSpace() == 0) - return markConstant(IV, &I, UndefValue::get(I.getType())); + return; // Transform load (constant global) into the value loaded. if (GlobalVariable *GV = dyn_cast<GlobalVariable>(Ptr)) { |