summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2012-06-24 10:15:42 +0000
committerNick Lewycky <nicholas@mxc.ca>2012-06-24 10:15:42 +0000
commit0a045bbe4e32e558da7561393f39cb907c0a4530 (patch)
tree15ea1226d42e9e13806f78f3e61a51d114e8a1e7 /llvm/lib/Transforms
parentfd5e6e7db1064ce0e94ce4a1ea774922b382f9b9 (diff)
downloadbcm5719-llvm-0a045bbe4e32e558da7561393f39cb907c0a4530.tar.gz
bcm5719-llvm-0a045bbe4e32e558da7561393f39cb907c0a4530.zip
Remove dyn_cast + dereference pattern by replacing it with a cast and changing
the safety check to look for the same type we're going to actually cast to. Fixes PR13180! llvm-svn: 159110
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyCFG.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 3d4d50a80a9..58a8b35f303 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -129,7 +129,7 @@ static bool SafeToMergeTerminators(TerminatorInst *SI1, TerminatorInst *SI2) {
///
static bool isProfitableToFoldUnconditional(BranchInst *SI1,
BranchInst *SI2,
- Instruction* Cond,
+ Instruction *Cond,
SmallVectorImpl<PHINode*> &PhiNodes) {
if (SI1 == SI2) return false; // Can't merge with self!
assert(SI1->isUnconditional() && SI2->isConditional());
@@ -156,7 +156,7 @@ static bool isProfitableToFoldUnconditional(BranchInst *SI1,
isa<PHINode>(BBI); ++BBI) {
PHINode *PN = cast<PHINode>(BBI);
if (PN->getIncomingValueForBlock(SI1BB) != Cond ||
- !isa<Constant>(PN->getIncomingValueForBlock(SI2BB)))
+ !isa<ConstantInt>(PN->getIncomingValueForBlock(SI2BB)))
return false;
PhiNodes.push_back(PN);
}
@@ -1782,7 +1782,7 @@ bool llvm::FoldBranchToCommonDest(BranchInst *BI) {
} else {
// Update PHI nodes in the common successors.
for (unsigned i = 0, e = PHIs.size(); i != e; ++i) {
- ConstantInt *PBI_C = dyn_cast<ConstantInt>(
+ ConstantInt *PBI_C = cast<ConstantInt>(
PHIs[i]->getIncomingValueForBlock(PBI->getParent()));
assert(PBI_C->getType()->isIntegerTy(1));
Instruction *MergedCond = 0;
OpenPOWER on IntegriCloud