mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-24 20:44:51 +00:00
Tighten the conditions under which we do PRE, remove some unneeded code, and correct our preserved analyses list, since we
do now change the CFG by splitting critical edges during PRE. llvm-svn: 52631
This commit is contained in:
parent
b992911447
commit
0dcae02ad4
@ -719,10 +719,11 @@ namespace {
|
||||
|
||||
// This transformation requires dominator postdominator info
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.setPreservesCFG();
|
||||
AU.addRequired<DominatorTree>();
|
||||
AU.addRequired<MemoryDependenceAnalysis>();
|
||||
AU.addRequired<AliasAnalysis>();
|
||||
|
||||
AU.addPreserved<DominatorTree>();
|
||||
AU.addPreserved<AliasAnalysis>();
|
||||
AU.addPreserved<MemoryDependenceAnalysis>();
|
||||
}
|
||||
@ -1019,7 +1020,11 @@ bool GVN::processLoad(LoadInst *L, DenseMap<Value*, LoadInst*> &lastLoad,
|
||||
}
|
||||
|
||||
Value* GVN::lookupNumber(BasicBlock* BB, uint32_t num) {
|
||||
ValueNumberScope* locals = localAvail[BB];
|
||||
DenseMap<BasicBlock*, ValueNumberScope*>::iterator I = localAvail.find(BB);
|
||||
if (I == localAvail.end())
|
||||
return 0;
|
||||
|
||||
ValueNumberScope* locals = I->second;
|
||||
|
||||
while (locals) {
|
||||
DenseMap<uint32_t, Value*>::iterator I = locals->table.find(num);
|
||||
@ -1167,9 +1172,9 @@ bool GVN::performPRE(Function& F) {
|
||||
|
||||
for (BasicBlock::iterator BI = CurrentBlock->begin(),
|
||||
BE = CurrentBlock->end(); BI != BE; ) {
|
||||
if (isa<AllocaInst>(BI) || isa<TerminatorInst>(BI) ||
|
||||
isa<LoadInst>(BI) || isa<StoreInst>(BI) ||
|
||||
isa<CallInst>(BI) || isa<PHINode>(BI)) {
|
||||
if (isa<AllocationInst>(BI) || isa<TerminatorInst>(BI) ||
|
||||
isa<PHINode>(BI) || BI->mayReadFromMemory() ||
|
||||
BI->mayWriteToMemory()) {
|
||||
BI++;
|
||||
continue;
|
||||
}
|
||||
@ -1282,13 +1287,6 @@ bool GVN::performPRE(Function& F) {
|
||||
Phi->addIncoming(predMap[*PI], *PI);
|
||||
|
||||
VN.add(Phi, valno);
|
||||
|
||||
// The newly created PHI completely replaces the old instruction,
|
||||
// so we need to update the maps to reflect this.
|
||||
DomTreeNode* DTN = getAnalysis<DominatorTree>()[CurrentBlock];
|
||||
for (DomTreeNode::iterator UI = DTN->begin(), UE = DTN->end();
|
||||
UI != UE; ++UI)
|
||||
localAvail[(*UI)->getBlock()]->table[valno] = Phi;
|
||||
localAvail[CurrentBlock]->table[valno] = Phi;
|
||||
|
||||
BI->replaceAllUsesWith(Phi);
|
||||
|
Loading…
Reference in New Issue
Block a user