summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2012-09-28 23:58:57 +0000
committerEvan Cheng <evan.cheng@apple.com>2012-09-28 23:58:57 +0000
commit64a223aed8d254deec1095460e7aca2252e984b1 (patch)
treeea8578bbb45e118bc72dc04b60dd03b24dbbbf0c /llvm/lib/Transforms
parent21dfcd9d41a1a325cd373bb0fcc0172400e94f44 (diff)
downloadbcm5719-llvm-64a223aed8d254deec1095460e7aca2252e984b1.tar.gz
bcm5719-llvm-64a223aed8d254deec1095460e7aca2252e984b1.zip
Do not delete BBs if their addresses are taken. rdar://12396696
llvm-svn: 164866
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp b/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
index 78568639539..305d70f27b0 100644
--- a/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
+++ b/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
@@ -226,7 +226,8 @@ bool CodeGenPrepare::EliminateFallThrough(Function &F) {
// edge, just collapse it.
BasicBlock *SinglePred = BB->getSinglePredecessor();
- if (!SinglePred || SinglePred == BB) continue;
+ // Don't merge if BB's address is taken.
+ if (!SinglePred || SinglePred == BB || BB->hasAddressTaken()) continue;
BranchInst *Term = dyn_cast<BranchInst>(SinglePred->getTerminator());
if (Term && !Term->isConditional()) {
@@ -788,7 +789,7 @@ bool CodeGenPrepare::DupRetToEnableTailCallOpts(ReturnInst *RI) {
}
// If we eliminated all predecessors of the block, delete the block now.
- if (Changed && pred_begin(BB) == pred_end(BB))
+ if (Changed && !BB->hasAddressTaken() && pred_begin(BB) == pred_end(BB))
BB->eraseFromParent();
return Changed;
OpenPOWER on IntegriCloud