//===- CorrelatedExprs.cpp - Pass to detect and eliminated c.e.'s ---------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file was developed by the LLVM research group and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
//
// Correlated Expression Elimination propagates information from conditional
// branches to blocks dominated by destinations of the branch. It propagates
void setReplacement(Value *Repl) { Replacement = Repl; }
// getRelation - return the relationship entry for the specified value.
- // This can invalidate references to other Relation's, so use it carefully.
+ // This can invalidate references to other Relations, so use it carefully.
//
Relation &getRelation(Value *V) {
// Binary search for V's entry...
DT = &getAnalysis<DominatorTree>();
std::set<BasicBlock*> VisitedBlocks;
- bool Changed = TransformRegion(&F.getEntryNode(), VisitedBlocks);
+ bool Changed = TransformRegion(&F.getEntryBlock(), VisitedBlocks);
RegionInfoMap.clear();
RankMap.clear();
DominatorTree::Node *BBN = (*DT)[BB];
if (!RI.empty()) // Time opt: only propagate if we can change something
for (unsigned i = 0, e = BBN->getChildren().size(); i != e; ++i) {
- BasicBlock *Dominated = BBN->getChildren()[i]->getNode();
+ BasicBlock *Dominated = BBN->getChildren()[i]->getBlock();
assert(RegionInfoMap.find(Dominated) == RegionInfoMap.end() &&
"RegionInfo should be calculated in dominanace order!");
getRegionInfo(Dominated) = RI;
// Now that all of our successors have information, recursively process them.
for (unsigned i = 0, e = BBN->getChildren().size(); i != e; ++i)
- Changed |= TransformRegion(BBN->getChildren()[i]->getNode(), VisitedBlocks);
+ Changed |= TransformRegion(BBN->getChildren()[i]->getBlock(),VisitedBlocks);
return Changed;
}
// Check the common case first: empty block, or block with just a setcc.
if (BB->size() == 1 ||
(BB->size() == 2 && &BB->front() == BI->getCondition() &&
- BI->getCondition()->use_size() == 1))
+ BI->getCondition()->hasOneUse()))
return true;
// Check the more complex case now...
return;
}
- // If the information propogted is new, then we want process the uses of this
+ // If the information propagated is new, then we want process the uses of this
// instruction to propagate the information down to them.
//
if (Op1R.incorporate(Opcode, VI))