forked from OSchip/llvm-project
NewGVN: Get rid of most dominating leader check
llvm-svn: 303443
This commit is contained in:
parent
a5130bbd12
commit
ff15200b1d
|
@ -104,8 +104,6 @@ STATISTIC(NumGVNLeaderChanges, "Number of leader changes");
|
|||
STATISTIC(NumGVNSortedLeaderChanges, "Number of sorted leader changes");
|
||||
STATISTIC(NumGVNAvoidedSortedLeaderChanges,
|
||||
"Number of avoided sorted leader changes");
|
||||
STATISTIC(NumGVNNotMostDominatingLeader,
|
||||
"Number of times a member dominated it's new classes' leader");
|
||||
STATISTIC(NumGVNDeadStores, "Number of redundant/dead stores eliminated");
|
||||
DEBUG_COUNTER(VNCounter, "newgvn-vn",
|
||||
"Controls which instructions are value numbered")
|
||||
|
@ -1946,31 +1944,11 @@ void NewGVN::moveValueToNewCongruenceClass(Instruction *I, const Expression *E,
|
|||
if (I == OldClass->getNextLeader().first)
|
||||
OldClass->resetNextLeader();
|
||||
|
||||
// It's possible, though unlikely, for us to discover equivalences such
|
||||
// that the current leader does not dominate the old one.
|
||||
// This statistic tracks how often this happens.
|
||||
// We assert on phi nodes when this happens, currently, for debugging, because
|
||||
// we want to make sure we name phi node cycles properly.
|
||||
if (isa<Instruction>(NewClass->getLeader()) && NewClass->getLeader() &&
|
||||
I != NewClass->getLeader()) {
|
||||
auto *IBB = I->getParent();
|
||||
auto *NCBB = cast<Instruction>(NewClass->getLeader())->getParent();
|
||||
bool Dominated =
|
||||
IBB == NCBB && InstrToDFSNum(I) < InstrToDFSNum(NewClass->getLeader());
|
||||
Dominated = Dominated || DT->properlyDominates(IBB, NCBB);
|
||||
if (Dominated) {
|
||||
++NumGVNNotMostDominatingLeader;
|
||||
assert(
|
||||
!isa<PHINode>(I) &&
|
||||
"New class for instruction should not be dominated by instruction");
|
||||
}
|
||||
}
|
||||
OldClass->erase(I);
|
||||
NewClass->insert(I);
|
||||
|
||||
if (NewClass->getLeader() != I)
|
||||
NewClass->addPossibleNextLeader({I, InstrToDFSNum(I)});
|
||||
|
||||
OldClass->erase(I);
|
||||
NewClass->insert(I);
|
||||
// Handle our special casing of stores.
|
||||
if (auto *SI = dyn_cast<StoreInst>(I)) {
|
||||
OldClass->decStoreCount();
|
||||
|
|
Loading…
Reference in New Issue