summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/ADCE.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Scalar/ADCE.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/ADCE.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/ADCE.cpp b/llvm/lib/Transforms/Scalar/ADCE.cpp
index ea36745c68a..18c851b1188 100644
--- a/llvm/lib/Transforms/Scalar/ADCE.cpp
+++ b/llvm/lib/Transforms/Scalar/ADCE.cpp
@@ -14,6 +14,7 @@
#include "llvm/Support/DepthFirstIterator.h"
#include "llvm/Analysis/Writer.h"
#include "llvm/iTerminators.h"
+#include "llvm/iOther.h"
#include <set>
#include <algorithm>
@@ -171,15 +172,15 @@ bool ADCE::doADCE() {
set<BasicBlock*> VisitedBlocks;
BasicBlock *EntryBlock = fixupCFG(M->front(), VisitedBlocks, AliveBlocks);
if (EntryBlock && EntryBlock != M->front()) {
- if (EntryBlock->front()->isPHINode()) {
+ if (isa<PHINode>(EntryBlock->front())) {
// Cannot make the first block be a block with a PHI node in it! Instead,
// strip the first basic block of the method to contain no instructions,
// then add a simple branch to the "real" entry node...
//
BasicBlock *E = M->front();
- if (!E->front()->isTerminator() || // Check for an actual change...
- ((TerminatorInst*)E->front())->getNumSuccessors() != 1 ||
- ((TerminatorInst*)E->front())->getSuccessor(0) != EntryBlock) {
+ if (!isa<TerminatorInst>(E->front()) || // Check for an actual change...
+ cast<TerminatorInst>(E->front())->getNumSuccessors() != 1 ||
+ cast<TerminatorInst>(E->front())->getSuccessor(0) != EntryBlock) {
E->getInstList().delete_all(); // Delete all instructions in block
E->getInstList().push_back(new BranchInst(EntryBlock));
MadeChanges = true;
OpenPOWER on IntegriCloud