aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2011-06-04 09:42:04 +0000
committerBill Wendling <isanbard@gmail.com>2011-06-04 09:42:04 +0000
commit6a648b8538bb4d4b3e96669ef8cd3a4ce3aedeb8 (patch)
treef642ba24bd0ebcc415766ff9d009c763a4a30cee /lib/Transforms
parentc017bc1c1e2fa0995e957f6c2ada1339832bb221 (diff)
downloadexternal_llvm-6a648b8538bb4d4b3e96669ef8cd3a4ce3aedeb8.zip
external_llvm-6a648b8538bb4d4b3e96669ef8cd3a4ce3aedeb8.tar.gz
external_llvm-6a648b8538bb4d4b3e96669ef8cd3a4ce3aedeb8.tar.bz2
If the block that we're threading through is jumped to by an indirect branch,
then we don't want to set the destination in the indirect branch to the destination. This is because the indirect branch needs its destinations to have had their block addresses taken. This isn't so of the new critical edge that's split during this process. If it turns out that the destination block has only one predecessor, and that being a BB with an indirect branch, then it won't be marked as 'used' and may be removed. PR10072 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132638 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Utils/SimplifyCFG.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp
index 5ab9a28..6df846c 100644
--- a/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -1171,6 +1171,8 @@ static bool FoldCondBranchOnPHI(BranchInst *BI, const TargetData *TD) {
BasicBlock *RealDest = BI->getSuccessor(!CB->getZExtValue());
if (RealDest == BB) continue; // Skip self loops.
+ // Skip if the predecessor's terminator is an indirect branch.
+ if (isa<IndirectBrInst>(PredBB->getTerminator())) continue;
// The dest block might have PHI nodes, other predecessors and other
// difficult cases. Instead of being smart about this, just insert a new
@@ -1226,7 +1228,7 @@ static bool FoldCondBranchOnPHI(BranchInst *BI, const TargetData *TD) {
BB->removePredecessor(PredBB);
PredBBTI->setSuccessor(i, EdgeBB);
}
-
+
// Recurse, simplifying any other constants.
return FoldCondBranchOnPHI(BI, TD) | true;
}