2008-05-15 04:38:44 +08:00
|
|
|
//===- SimplifyCFGPass.cpp - CFG Simplification Pass ----------------------===//
|
2005-04-22 07:48:37 +08:00
|
|
|
//
|
2003-10-21 03:43:21 +08:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-30 04:36:04 +08:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-04-22 07:48:37 +08:00
|
|
|
//
|
2003-10-21 03:43:21 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2002-05-22 04:49:37 +08:00
|
|
|
//
|
2007-12-04 03:43:18 +08:00
|
|
|
// This file implements dead code elimination and basic block merging, along
|
|
|
|
// with a collection of other peephole control flow optimizations. For example:
|
2002-05-22 04:49:37 +08:00
|
|
|
//
|
2007-11-05 00:15:04 +08:00
|
|
|
// * Removes basic blocks with no predecessors.
|
|
|
|
// * Merges a basic block into its predecessor if there is only one and the
|
2002-05-22 04:49:37 +08:00
|
|
|
// predecessor only has one successor.
|
2007-11-05 00:15:04 +08:00
|
|
|
// * Eliminates PHI nodes for basic blocks with a single predecessor.
|
|
|
|
// * Eliminates a basic block that only contains an unconditional branch.
|
2007-12-04 03:43:18 +08:00
|
|
|
// * Changes invoke instructions to nounwind functions to be calls.
|
|
|
|
// * Change things like "if (x) if (y)" into "if (x&y)".
|
|
|
|
// * etc..
|
2002-05-22 04:49:37 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2006-12-20 05:40:18 +08:00
|
|
|
#define DEBUG_TYPE "simplifycfg"
|
2002-05-22 04:49:37 +08:00
|
|
|
#include "llvm/Transforms/Scalar.h"
|
|
|
|
#include "llvm/Transforms/Utils/Local.h"
|
2004-10-18 11:00:50 +08:00
|
|
|
#include "llvm/Constants.h"
|
|
|
|
#include "llvm/Instructions.h"
|
2010-03-14 18:40:55 +08:00
|
|
|
#include "llvm/IntrinsicInst.h"
|
2002-05-22 04:49:37 +08:00
|
|
|
#include "llvm/Module.h"
|
2008-09-24 07:03:40 +08:00
|
|
|
#include "llvm/Attributes.h"
|
2002-05-22 04:49:37 +08:00
|
|
|
#include "llvm/Support/CFG.h"
|
|
|
|
#include "llvm/Pass.h"
|
2010-02-06 06:03:18 +08:00
|
|
|
#include "llvm/Target/TargetData.h"
|
2007-11-13 15:32:38 +08:00
|
|
|
#include "llvm/ADT/SmallVector.h"
|
2007-03-04 12:20:48 +08:00
|
|
|
#include "llvm/ADT/SmallPtrSet.h"
|
2004-09-02 06:55:40 +08:00
|
|
|
#include "llvm/ADT/Statistic.h"
|
2004-01-09 14:02:20 +08:00
|
|
|
using namespace llvm;
|
2003-11-12 06:41:34 +08:00
|
|
|
|
2006-12-20 05:40:18 +08:00
|
|
|
STATISTIC(NumSimpl, "Number of blocks simplified");
|
2002-10-02 06:38:41 +08:00
|
|
|
|
2006-12-20 05:40:18 +08:00
|
|
|
namespace {
|
2009-09-02 14:11:42 +08:00
|
|
|
struct CFGSimplifyPass : public FunctionPass {
|
2007-05-06 21:37:16 +08:00
|
|
|
static char ID; // Pass identification, replacement for typeid
|
2010-10-20 01:21:58 +08:00
|
|
|
CFGSimplifyPass() : FunctionPass(ID) {
|
|
|
|
initializeCFGSimplifyPassPass(*PassRegistry::getPassRegistry());
|
|
|
|
}
|
2007-05-02 05:15:47 +08:00
|
|
|
|
2002-06-26 00:13:24 +08:00
|
|
|
virtual bool runOnFunction(Function &F);
|
2002-05-22 04:49:37 +08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2008-05-13 08:00:25 +08:00
|
|
|
char CFGSimplifyPass::ID = 0;
|
2010-07-22 06:09:45 +08:00
|
|
|
INITIALIZE_PASS(CFGSimplifyPass, "simplifycfg",
|
2010-10-08 06:25:06 +08:00
|
|
|
"Simplify the CFG", false, false)
|
2008-05-13 08:00:25 +08:00
|
|
|
|
2003-11-12 06:41:34 +08:00
|
|
|
// Public interface to the CFGSimplification pass
|
2004-01-09 14:02:20 +08:00
|
|
|
FunctionPass *llvm::createCFGSimplificationPass() {
|
2002-05-22 04:49:37 +08:00
|
|
|
return new CFGSimplifyPass();
|
|
|
|
}
|
|
|
|
|
2007-11-14 14:19:25 +08:00
|
|
|
/// ChangeToUnreachable - Insert an unreachable instruction before the specified
|
|
|
|
/// instruction, making it and the rest of the code in the block dead.
|
2010-05-09 06:15:59 +08:00
|
|
|
static void ChangeToUnreachable(Instruction *I, bool UseLLVMTrap) {
|
2007-11-14 14:19:25 +08:00
|
|
|
BasicBlock *BB = I->getParent();
|
|
|
|
// Loop over all of the successors, removing BB's entry from any PHI
|
|
|
|
// nodes.
|
|
|
|
for (succ_iterator SI = succ_begin(BB), SE = succ_end(BB); SI != SE; ++SI)
|
|
|
|
(*SI)->removePredecessor(BB);
|
|
|
|
|
2010-05-09 06:15:59 +08:00
|
|
|
// Insert a call to llvm.trap right before this. This turns the undefined
|
|
|
|
// behavior into a hard fail instead of falling through into random code.
|
|
|
|
if (UseLLVMTrap) {
|
|
|
|
Function *TrapFn =
|
|
|
|
Intrinsic::getDeclaration(BB->getParent()->getParent(), Intrinsic::trap);
|
2011-04-28 01:59:27 +08:00
|
|
|
CallInst *CallTrap = CallInst::Create(TrapFn, "", I);
|
|
|
|
CallTrap->setDebugLoc(I->getDebugLoc());
|
2010-05-09 06:15:59 +08:00
|
|
|
}
|
2009-08-14 05:58:54 +08:00
|
|
|
new UnreachableInst(I->getContext(), I);
|
2007-11-14 14:19:25 +08:00
|
|
|
|
|
|
|
// All instructions after this are dead.
|
|
|
|
BasicBlock::iterator BBI = I, BBE = BB->end();
|
|
|
|
while (BBI != BBE) {
|
|
|
|
if (!BBI->use_empty())
|
2009-07-31 07:03:37 +08:00
|
|
|
BBI->replaceAllUsesWith(UndefValue::get(BBI->getType()));
|
2007-11-14 14:19:25 +08:00
|
|
|
BB->getInstList().erase(BBI++);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-11-23 06:24:59 +08:00
|
|
|
/// ChangeToCall - Convert the specified invoke into a normal call.
|
|
|
|
static void ChangeToCall(InvokeInst *II) {
|
2010-03-24 21:21:49 +08:00
|
|
|
SmallVector<Value*, 8> Args(II->op_begin(), II->op_end() - 3);
|
2011-07-15 16:37:34 +08:00
|
|
|
CallInst *NewCall = CallInst::Create(II->getCalledValue(), Args, "", II);
|
2007-11-23 06:24:59 +08:00
|
|
|
NewCall->takeName(II);
|
|
|
|
NewCall->setCallingConv(II->getCallingConv());
|
2008-09-26 05:00:45 +08:00
|
|
|
NewCall->setAttributes(II->getAttributes());
|
2011-06-03 06:46:58 +08:00
|
|
|
NewCall->setDebugLoc(II->getDebugLoc());
|
2007-11-23 06:24:59 +08:00
|
|
|
II->replaceAllUsesWith(NewCall);
|
|
|
|
|
|
|
|
// Follow the call by a branch to the normal destination.
|
2008-04-07 04:25:17 +08:00
|
|
|
BranchInst::Create(II->getNormalDest(), II);
|
2012-07-03 00:14:47 +08:00
|
|
|
|
|
|
|
// Update PHI nodes in the unwind destination
|
|
|
|
II->getUnwindDest()->removePredecessor(II->getParent());
|
2012-06-29 06:32:27 +08:00
|
|
|
II->eraseFromParent();
|
2007-11-23 06:24:59 +08:00
|
|
|
}
|
|
|
|
|
2007-03-04 12:20:48 +08:00
|
|
|
static bool MarkAliveBlocks(BasicBlock *BB,
|
2009-11-23 11:34:29 +08:00
|
|
|
SmallPtrSet<BasicBlock*, 128> &Reachable) {
|
2007-04-05 09:27:02 +08:00
|
|
|
|
2007-11-13 15:32:38 +08:00
|
|
|
SmallVector<BasicBlock*, 128> Worklist;
|
2007-04-05 09:27:02 +08:00
|
|
|
Worklist.push_back(BB);
|
|
|
|
bool Changed = false;
|
2010-01-06 00:27:25 +08:00
|
|
|
do {
|
|
|
|
BB = Worklist.pop_back_val();
|
2007-04-05 09:27:02 +08:00
|
|
|
|
|
|
|
if (!Reachable.insert(BB))
|
|
|
|
continue;
|
2002-05-22 04:49:37 +08:00
|
|
|
|
2007-04-05 09:27:02 +08:00
|
|
|
// Do a quick scan of the basic block, turning any obviously unreachable
|
|
|
|
// instructions into LLVM unreachable insts. The instruction combining pass
|
2007-11-23 06:24:59 +08:00
|
|
|
// canonicalizes unreachable insts into stores to null or undef.
|
2007-11-14 14:19:25 +08:00
|
|
|
for (BasicBlock::iterator BBI = BB->begin(), E = BB->end(); BBI != E;++BBI){
|
|
|
|
if (CallInst *CI = dyn_cast<CallInst>(BBI)) {
|
2007-12-18 17:59:50 +08:00
|
|
|
if (CI->doesNotReturn()) {
|
2007-11-14 14:19:25 +08:00
|
|
|
// If we found a call to a no-return function, insert an unreachable
|
|
|
|
// instruction after it. Make sure there isn't *already* one there
|
|
|
|
// though.
|
|
|
|
++BBI;
|
|
|
|
if (!isa<UnreachableInst>(BBI)) {
|
2010-05-09 06:15:59 +08:00
|
|
|
// Don't insert a call to llvm.trap right before the unreachable.
|
|
|
|
ChangeToUnreachable(BBI, false);
|
2007-11-14 14:19:25 +08:00
|
|
|
Changed = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-02 02:42:03 +08:00
|
|
|
// Store to undef and store to null are undefined and used to signal that
|
|
|
|
// they should be changed to unreachable by passes that can't modify the
|
|
|
|
// CFG.
|
2009-06-13 05:01:07 +08:00
|
|
|
if (StoreInst *SI = dyn_cast<StoreInst>(BBI)) {
|
2010-06-13 22:35:54 +08:00
|
|
|
// Don't touch volatile stores.
|
|
|
|
if (SI->isVolatile()) continue;
|
|
|
|
|
2009-06-13 05:01:07 +08:00
|
|
|
Value *Ptr = SI->getOperand(1);
|
2009-07-15 01:48:25 +08:00
|
|
|
|
|
|
|
if (isa<UndefValue>(Ptr) ||
|
|
|
|
(isa<ConstantPointerNull>(Ptr) &&
|
2009-08-31 04:06:40 +08:00
|
|
|
SI->getPointerAddressSpace() == 0)) {
|
2010-05-09 06:15:59 +08:00
|
|
|
ChangeToUnreachable(SI, true);
|
2009-07-15 01:48:25 +08:00
|
|
|
Changed = true;
|
|
|
|
break;
|
|
|
|
}
|
2009-06-13 05:01:07 +08:00
|
|
|
}
|
2007-11-14 14:19:25 +08:00
|
|
|
}
|
2004-10-18 11:00:50 +08:00
|
|
|
|
2007-11-23 06:24:59 +08:00
|
|
|
// Turn invokes that call 'nounwind' functions into ordinary calls.
|
2012-06-26 01:11:47 +08:00
|
|
|
if (InvokeInst *II = dyn_cast<InvokeInst>(BB->getTerminator())) {
|
|
|
|
Value *Callee = II->getCalledValue();
|
|
|
|
if (isa<ConstantPointerNull>(Callee) || isa<UndefValue>(Callee)) {
|
|
|
|
ChangeToUnreachable(II, true);
|
|
|
|
Changed = true;
|
|
|
|
} else if (II->doesNotThrow()) {
|
2012-06-29 06:32:27 +08:00
|
|
|
if (II->use_empty() && II->onlyReadsMemory()) {
|
|
|
|
// jump to the normal destination branch.
|
|
|
|
BranchInst::Create(II->getNormalDest(), II);
|
2012-07-17 06:49:40 +08:00
|
|
|
II->getUnwindDest()->removePredecessor(II->getParent());
|
2012-06-29 06:32:27 +08:00
|
|
|
II->eraseFromParent();
|
|
|
|
} else
|
|
|
|
ChangeToCall(II);
|
2007-11-23 06:24:59 +08:00
|
|
|
Changed = true;
|
|
|
|
}
|
2012-06-26 01:11:47 +08:00
|
|
|
}
|
2007-11-23 06:24:59 +08:00
|
|
|
|
2011-05-23 00:24:18 +08:00
|
|
|
Changed |= ConstantFoldTerminator(BB, true);
|
2007-04-05 09:27:02 +08:00
|
|
|
for (succ_iterator SI = succ_begin(BB), SE = succ_end(BB); SI != SE; ++SI)
|
|
|
|
Worklist.push_back(*SI);
|
2010-01-06 00:27:25 +08:00
|
|
|
} while (!Worklist.empty());
|
2002-05-22 04:49:37 +08:00
|
|
|
return Changed;
|
|
|
|
}
|
|
|
|
|
2008-09-09 06:14:17 +08:00
|
|
|
/// RemoveUnreachableBlocksFromFn - Remove blocks that are not reachable, even
|
|
|
|
/// if they are in a dead cycle. Return true if a change was made, false
|
|
|
|
/// otherwise.
|
|
|
|
static bool RemoveUnreachableBlocksFromFn(Function &F) {
|
2007-11-13 15:32:38 +08:00
|
|
|
SmallPtrSet<BasicBlock*, 128> Reachable;
|
2009-11-23 11:34:29 +08:00
|
|
|
bool Changed = MarkAliveBlocks(F.begin(), Reachable);
|
2007-11-13 15:32:38 +08:00
|
|
|
|
2002-05-22 04:49:37 +08:00
|
|
|
// If there are unreachable blocks in the CFG...
|
2008-01-26 14:51:24 +08:00
|
|
|
if (Reachable.size() == F.size())
|
2007-11-13 15:32:38 +08:00
|
|
|
return Changed;
|
|
|
|
|
|
|
|
assert(Reachable.size() < F.size());
|
|
|
|
NumSimpl += F.size()-Reachable.size();
|
|
|
|
|
|
|
|
// Loop over all of the basic blocks that are not reachable, dropping all of
|
|
|
|
// their internal references...
|
2008-02-14 15:39:01 +08:00
|
|
|
for (Function::iterator BB = ++F.begin(), E = F.end(); BB != E; ++BB) {
|
|
|
|
if (Reachable.count(BB))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
for (succ_iterator SI = succ_begin(BB), SE = succ_end(BB); SI != SE; ++SI)
|
|
|
|
if (Reachable.count(*SI))
|
|
|
|
(*SI)->removePredecessor(BB);
|
|
|
|
BB->dropAllReferences();
|
|
|
|
}
|
2007-11-13 15:32:38 +08:00
|
|
|
|
|
|
|
for (Function::iterator I = ++F.begin(); I != F.end();)
|
|
|
|
if (!Reachable.count(I))
|
|
|
|
I = F.getBasicBlockList().erase(I);
|
|
|
|
else
|
|
|
|
++I;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2002-05-22 04:49:37 +08:00
|
|
|
|
2009-12-22 14:07:30 +08:00
|
|
|
/// MergeEmptyReturnBlocks - If we have more than one empty (other than phi
|
|
|
|
/// node) return blocks, merge them together to promote recursive block merging.
|
|
|
|
static bool MergeEmptyReturnBlocks(Function &F) {
|
|
|
|
bool Changed = false;
|
|
|
|
|
|
|
|
BasicBlock *RetBlock = 0;
|
|
|
|
|
|
|
|
// Scan all the blocks in the function, looking for empty return blocks.
|
|
|
|
for (Function::iterator BBI = F.begin(), E = F.end(); BBI != E; ) {
|
|
|
|
BasicBlock &BB = *BBI++;
|
|
|
|
|
|
|
|
// Only look at return blocks.
|
|
|
|
ReturnInst *Ret = dyn_cast<ReturnInst>(BB.getTerminator());
|
|
|
|
if (Ret == 0) continue;
|
|
|
|
|
|
|
|
// Only look at the block if it is empty or the only other thing in it is a
|
|
|
|
// single PHI node that is the operand to the return.
|
|
|
|
if (Ret != &BB.front()) {
|
|
|
|
// Check for something else in the block.
|
|
|
|
BasicBlock::iterator I = Ret;
|
|
|
|
--I;
|
2010-03-14 18:40:55 +08:00
|
|
|
// Skip over debug info.
|
|
|
|
while (isa<DbgInfoIntrinsic>(I) && I != BB.begin())
|
|
|
|
--I;
|
|
|
|
if (!isa<DbgInfoIntrinsic>(I) &&
|
|
|
|
(!isa<PHINode>(I) || I != BB.begin() ||
|
|
|
|
Ret->getNumOperands() == 0 ||
|
|
|
|
Ret->getOperand(0) != I))
|
2009-12-22 14:07:30 +08:00
|
|
|
continue;
|
|
|
|
}
|
2010-03-14 18:40:55 +08:00
|
|
|
|
2009-12-22 14:07:30 +08:00
|
|
|
// If this is the first returning block, remember it and keep going.
|
|
|
|
if (RetBlock == 0) {
|
|
|
|
RetBlock = &BB;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Otherwise, we found a duplicate return block. Merge the two.
|
|
|
|
Changed = true;
|
|
|
|
|
|
|
|
// Case when there is no input to the return or when the returned values
|
|
|
|
// agree is trivial. Note that they can't agree if there are phis in the
|
|
|
|
// blocks.
|
|
|
|
if (Ret->getNumOperands() == 0 ||
|
|
|
|
Ret->getOperand(0) ==
|
|
|
|
cast<ReturnInst>(RetBlock->getTerminator())->getOperand(0)) {
|
|
|
|
BB.replaceAllUsesWith(RetBlock);
|
|
|
|
BB.eraseFromParent();
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
// If the canonical return block has no PHI node, create one now.
|
|
|
|
PHINode *RetBlockPHI = dyn_cast<PHINode>(RetBlock->begin());
|
|
|
|
if (RetBlockPHI == 0) {
|
2010-03-16 03:05:46 +08:00
|
|
|
Value *InVal = cast<ReturnInst>(RetBlock->getTerminator())->getOperand(0);
|
2011-03-30 19:19:20 +08:00
|
|
|
pred_iterator PB = pred_begin(RetBlock), PE = pred_end(RetBlock);
|
2011-03-30 19:28:46 +08:00
|
|
|
RetBlockPHI = PHINode::Create(Ret->getOperand(0)->getType(),
|
|
|
|
std::distance(PB, PE), "merge",
|
2009-12-22 14:07:30 +08:00
|
|
|
&RetBlock->front());
|
|
|
|
|
2011-03-30 19:19:20 +08:00
|
|
|
for (pred_iterator PI = PB; PI != PE; ++PI)
|
2009-12-22 14:07:30 +08:00
|
|
|
RetBlockPHI->addIncoming(InVal, *PI);
|
|
|
|
RetBlock->getTerminator()->setOperand(0, RetBlockPHI);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Turn BB into a block that just unconditionally branches to the return
|
|
|
|
// block. This handles the case when the two return blocks have a common
|
|
|
|
// predecessor but that return different things.
|
|
|
|
RetBlockPHI->addIncoming(Ret->getOperand(0), &BB);
|
|
|
|
BB.getTerminator()->eraseFromParent();
|
|
|
|
BranchInst::Create(RetBlock, &BB);
|
|
|
|
}
|
|
|
|
|
|
|
|
return Changed;
|
|
|
|
}
|
|
|
|
|
2007-11-13 15:32:38 +08:00
|
|
|
/// IterativeSimplifyCFG - Call SimplifyCFG on all the blocks in the function,
|
|
|
|
/// iterating until no more changes are made.
|
2010-02-06 06:03:18 +08:00
|
|
|
static bool IterativeSimplifyCFG(Function &F, const TargetData *TD) {
|
2007-11-13 15:32:38 +08:00
|
|
|
bool Changed = false;
|
2002-05-22 04:49:37 +08:00
|
|
|
bool LocalChange = true;
|
|
|
|
while (LocalChange) {
|
|
|
|
LocalChange = false;
|
2007-11-13 15:32:38 +08:00
|
|
|
|
2010-08-14 08:29:42 +08:00
|
|
|
// Loop over all of the basic blocks and remove them if they are unneeded...
|
2002-05-22 04:49:37 +08:00
|
|
|
//
|
2010-08-14 08:29:42 +08:00
|
|
|
for (Function::iterator BBIt = F.begin(); BBIt != F.end(); ) {
|
2010-02-06 06:03:18 +08:00
|
|
|
if (SimplifyCFG(BBIt++, TD)) {
|
2002-05-22 04:49:37 +08:00
|
|
|
LocalChange = true;
|
|
|
|
++NumSimpl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Changed |= LocalChange;
|
|
|
|
}
|
|
|
|
return Changed;
|
|
|
|
}
|
2007-11-13 15:32:38 +08:00
|
|
|
|
|
|
|
// It is possible that we may require multiple passes over the code to fully
|
|
|
|
// simplify the CFG.
|
|
|
|
//
|
|
|
|
bool CFGSimplifyPass::runOnFunction(Function &F) {
|
2010-02-06 06:03:18 +08:00
|
|
|
const TargetData *TD = getAnalysisIfAvailable<TargetData>();
|
2008-09-09 06:14:17 +08:00
|
|
|
bool EverChanged = RemoveUnreachableBlocksFromFn(F);
|
2009-12-22 14:07:30 +08:00
|
|
|
EverChanged |= MergeEmptyReturnBlocks(F);
|
2010-02-06 06:03:18 +08:00
|
|
|
EverChanged |= IterativeSimplifyCFG(F, TD);
|
|
|
|
|
2007-11-13 15:32:38 +08:00
|
|
|
// If neither pass changed anything, we're done.
|
|
|
|
if (!EverChanged) return false;
|
|
|
|
|
|
|
|
// IterativeSimplifyCFG can (rarely) make some loops dead. If this happens,
|
2008-09-09 06:14:17 +08:00
|
|
|
// RemoveUnreachableBlocksFromFn is needed to nuke them, which means we should
|
2007-11-13 15:32:38 +08:00
|
|
|
// iterate between the two optimizations. We structure the code like this to
|
|
|
|
// avoid reruning IterativeSimplifyCFG if the second pass of
|
2008-09-09 06:14:17 +08:00
|
|
|
// RemoveUnreachableBlocksFromFn doesn't do anything.
|
|
|
|
if (!RemoveUnreachableBlocksFromFn(F))
|
2007-11-13 15:32:38 +08:00
|
|
|
return true;
|
2010-02-06 06:03:18 +08:00
|
|
|
|
2007-11-13 15:32:38 +08:00
|
|
|
do {
|
2010-02-06 06:03:18 +08:00
|
|
|
EverChanged = IterativeSimplifyCFG(F, TD);
|
2008-09-09 06:14:17 +08:00
|
|
|
EverChanged |= RemoveUnreachableBlocksFromFn(F);
|
2007-11-13 15:32:38 +08:00
|
|
|
} while (EverChanged);
|
2010-02-06 06:03:18 +08:00
|
|
|
|
2007-11-13 15:32:38 +08:00
|
|
|
return true;
|
|
|
|
}
|