mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-09 16:45:03 +00:00
remove dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96109 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
591047f714
commit
c09687bb7e
@ -32,7 +32,6 @@
|
||||
#include "llvm/ADT/SmallSet.h"
|
||||
#include "llvm/Assembly/Writer.h"
|
||||
#include "llvm/Support/CallSite.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/GetElementPtrTypeIterator.h"
|
||||
#include "llvm/Support/PatternMatch.h"
|
||||
@ -40,9 +39,6 @@
|
||||
using namespace llvm;
|
||||
using namespace llvm::PatternMatch;
|
||||
|
||||
static cl::opt<bool> FactorCommonPreds("split-critical-paths-tweak",
|
||||
cl::init(false), cl::Hidden);
|
||||
|
||||
namespace {
|
||||
class CodeGenPrepare : public FunctionPass {
|
||||
/// TLI - Keep a pointer of a TargetLowering to consult for determining
|
||||
@ -392,51 +388,16 @@ static void SplitEdgeNicely(TerminatorInst *TI, unsigned SuccNum,
|
||||
if (BackEdges.count(std::make_pair(TIBB, Dest)))
|
||||
return;
|
||||
|
||||
if (!FactorCommonPreds) {
|
||||
if (BasicBlock *ReuseBB = FindReusablePredBB(DestPHI, TIBB)) {
|
||||
ProfileInfo *PFI = P->getAnalysisIfAvailable<ProfileInfo>();
|
||||
if (PFI)
|
||||
PFI->splitEdge(TIBB, Dest, ReuseBB);
|
||||
Dest->removePredecessor(TIBB);
|
||||
TI->setSuccessor(SuccNum, ReuseBB);
|
||||
return;
|
||||
}
|
||||
|
||||
SplitCriticalEdge(TI, SuccNum, P, true);
|
||||
if (BasicBlock *ReuseBB = FindReusablePredBB(DestPHI, TIBB)) {
|
||||
ProfileInfo *PFI = P->getAnalysisIfAvailable<ProfileInfo>();
|
||||
if (PFI)
|
||||
PFI->splitEdge(TIBB, Dest, ReuseBB);
|
||||
Dest->removePredecessor(TIBB);
|
||||
TI->setSuccessor(SuccNum, ReuseBB);
|
||||
return;
|
||||
}
|
||||
|
||||
PHINode *PN;
|
||||
SmallVector<Value*, 8> TIPHIValues;
|
||||
for (BasicBlock::iterator I = Dest->begin();
|
||||
(PN = dyn_cast<PHINode>(I)); ++I)
|
||||
TIPHIValues.push_back(PN->getIncomingValueForBlock(TIBB));
|
||||
|
||||
SmallVector<BasicBlock*, 8> IdenticalPreds;
|
||||
|
||||
for (unsigned pi = 0, e = DestPHI->getNumIncomingValues(); pi != e; ++pi) {
|
||||
BasicBlock *Pred = DestPHI->getIncomingBlock(pi);
|
||||
if (BackEdges.count(std::make_pair(Pred, Dest)))
|
||||
continue;
|
||||
if (Pred == TIBB) {
|
||||
IdenticalPreds.push_back(Pred);
|
||||
continue;
|
||||
}
|
||||
bool Identical = true;
|
||||
unsigned PHINo = 0;
|
||||
for (BasicBlock::iterator I = Dest->begin();
|
||||
(PN = dyn_cast<PHINode>(I)); ++I, ++PHINo)
|
||||
if (TIPHIValues[PHINo] != PN->getIncomingValueForBlock(Pred)) {
|
||||
Identical = false;
|
||||
break;
|
||||
}
|
||||
if (Identical)
|
||||
IdenticalPreds.push_back(Pred);
|
||||
}
|
||||
|
||||
assert(!IdenticalPreds.empty());
|
||||
SplitBlockPredecessors(Dest, &IdenticalPreds[0], IdenticalPreds.size(),
|
||||
".critedge", P);
|
||||
SplitCriticalEdge(TI, SuccNum, P, true);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user