summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-06-12 21:01:07 +0000
committerChris Lattner <sabre@nondot.org>2009-06-12 21:01:07 +0000
commit3dd5c5d28a0443d9321d0d646ed59858ce16e2b2 (patch)
treeea64f583b4a9f0f76140b3cfeb7c43093ef4492f /llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
parentd93b5b672f24ee49f11dd90352c3289aca5aef5e (diff)
downloadbcm5719-llvm-3dd5c5d28a0443d9321d0d646ed59858ce16e2b2.tar.gz
bcm5719-llvm-3dd5c5d28a0443d9321d0d646ed59858ce16e2b2.zip
second half of fix for PR4366: don't zap store to null of
non-default addrspaces. llvm-svn: 73253
Diffstat (limited to 'llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp b/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
index b499279c696..5a85a047bec 100644
--- a/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
+++ b/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
@@ -125,13 +125,17 @@ static bool MarkAliveBlocks(BasicBlock *BB,
}
}
- if (StoreInst *SI = dyn_cast<StoreInst>(BBI))
- if (isa<ConstantPointerNull>(SI->getOperand(1)) ||
- isa<UndefValue>(SI->getOperand(1))) {
+ if (StoreInst *SI = dyn_cast<StoreInst>(BBI)) {
+ Value *Ptr = SI->getOperand(1);
+
+ if (isa<UndefValue>(Ptr) ||
+ (isa<ConstantPointerNull>(Ptr) &&
+ cast<PointerType>(Ptr->getType())->getAddressSpace() == 0)) {
ChangeToUnreachable(SI);
Changed = true;
break;
}
+ }
}
// Turn invokes that call 'nounwind' functions into ordinary calls.
OpenPOWER on IntegriCloud