mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-23 01:25:32 +00:00
Change PHINode::hasConstantValue to have a DominatorTree argument
instead of a bool argument, and to do the dominator check itself. This makes it eaiser to use when DominatorTree information is available. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80920 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -255,7 +255,7 @@ ReprocessLoop:
|
||||
PHINode *PN;
|
||||
for (BasicBlock::iterator I = L->getHeader()->begin();
|
||||
(PN = dyn_cast<PHINode>(I++)); )
|
||||
if (Value *V = PN->hasConstantValue()) {
|
||||
if (Value *V = PN->hasConstantValue(DT)) {
|
||||
if (AA) AA->deleteValue(PN);
|
||||
PN->replaceAllUsesWith(V);
|
||||
PN->eraseFromParent();
|
||||
@@ -417,14 +417,13 @@ static PHINode *FindPHIToPartitionLoops(Loop *L, DominatorTree *DT,
|
||||
for (BasicBlock::iterator I = L->getHeader()->begin(); isa<PHINode>(I); ) {
|
||||
PHINode *PN = cast<PHINode>(I);
|
||||
++I;
|
||||
if (Value *V = PN->hasConstantValue())
|
||||
if (!isa<Instruction>(V) || DT->dominates(cast<Instruction>(V), PN)) {
|
||||
// This is a degenerate PHI already, don't modify it!
|
||||
PN->replaceAllUsesWith(V);
|
||||
if (AA) AA->deleteValue(PN);
|
||||
PN->eraseFromParent();
|
||||
continue;
|
||||
}
|
||||
if (Value *V = PN->hasConstantValue(DT)) {
|
||||
// This is a degenerate PHI already, don't modify it!
|
||||
PN->replaceAllUsesWith(V);
|
||||
if (AA) AA->deleteValue(PN);
|
||||
PN->eraseFromParent();
|
||||
continue;
|
||||
}
|
||||
|
||||
// Scan this PHI node looking for a use of the PHI node by itself.
|
||||
for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i)
|
||||
|
Reference in New Issue
Block a user