Commit more code over to new cast style

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@697 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2001-10-02 03:41:24 +00:00
parent 1d87bcf490
commit b00c582b6d
42 changed files with 349 additions and 233 deletions

View File

@@ -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;