mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-08 03:30:22 +00:00
Fix a bug that was causing major slowdowns in povray. This was due to LCSSA
not handling PHI nodes correctly when determining if a value was live-out. This patch reduces the number of detected live-out variables in the testcase from 6565 to 485. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28771 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0e4dd01ffc
commit
7be3f1e078
@ -91,6 +91,7 @@ const PassInfo *llvm::LCSSAID = X.getPassInfo();
|
|||||||
/// runOnFunction - Process all loops in the function, inner-most out.
|
/// runOnFunction - Process all loops in the function, inner-most out.
|
||||||
bool LCSSA::runOnFunction(Function &F) {
|
bool LCSSA::runOnFunction(Function &F) {
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
|
||||||
LI = &getAnalysis<LoopInfo>();
|
LI = &getAnalysis<LoopInfo>();
|
||||||
DF = &getAnalysis<DominanceFrontier>();
|
DF = &getAnalysis<DominanceFrontier>();
|
||||||
DT = &getAnalysis<DominatorTree>();
|
DT = &getAnalysis<DominatorTree>();
|
||||||
@ -107,7 +108,7 @@ bool LCSSA::runOnFunction(Function &F) {
|
|||||||
bool LCSSA::visitSubloop(Loop* L) {
|
bool LCSSA::visitSubloop(Loop* L) {
|
||||||
for (Loop::iterator I = L->begin(), E = L->end(); I != E; ++I)
|
for (Loop::iterator I = L->begin(), E = L->end(); I != E; ++I)
|
||||||
visitSubloop(*I);
|
visitSubloop(*I);
|
||||||
|
|
||||||
// Speed up queries by creating a sorted list of blocks
|
// Speed up queries by creating a sorted list of blocks
|
||||||
LoopBlocks.clear();
|
LoopBlocks.clear();
|
||||||
LoopBlocks.insert(LoopBlocks.end(), L->block_begin(), L->block_end());
|
LoopBlocks.insert(LoopBlocks.end(), L->block_begin(), L->block_end());
|
||||||
@ -162,7 +163,6 @@ void LCSSA::processInstruction(Instruction* Instr,
|
|||||||
phi = new PHINode(Instr->getType(), Instr->getName()+".lcssa",
|
phi = new PHINode(Instr->getType(), Instr->getName()+".lcssa",
|
||||||
(*BBI)->begin());
|
(*BBI)->begin());
|
||||||
workList.push_back(cast<PHINode>(phi));
|
workList.push_back(cast<PHINode>(phi));
|
||||||
Phis[*BBI] = phi;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,6 +253,11 @@ SetVector<Instruction*> LCSSA::getLoopValuesUsedOutsideLoop(Loop *L) {
|
|||||||
for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); UI != E;
|
for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); UI != E;
|
||||||
++UI) {
|
++UI) {
|
||||||
BasicBlock *UserBB = cast<Instruction>(*UI)->getParent();
|
BasicBlock *UserBB = cast<Instruction>(*UI)->getParent();
|
||||||
|
if (PHINode* p = dyn_cast<PHINode>(*UI)) {
|
||||||
|
unsigned OperandNo = UI.getOperandNo();
|
||||||
|
UserBB = p->getIncomingBlock(OperandNo/2);
|
||||||
|
}
|
||||||
|
|
||||||
if (!inLoop(UserBB)) {
|
if (!inLoop(UserBB)) {
|
||||||
AffectedValues.insert(I);
|
AffectedValues.insert(I);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user