X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FAnalysis%2FLoadValueNumbering.cpp;h=f99ebb4a83d3b50bdbef4a6c9d0105502d44e54e;hb=a3ec5d6eccb0fa3746050a3d3c739bd9718b6bd0;hp=bbb1e1e1b0dbdfadb7e94a1275e3e8aaa5d0610e;hpb=4f4c28f75f74fe557efb63feaf5f4f8bf639dcd5;p=oota-llvm.git diff --git a/lib/Analysis/LoadValueNumbering.cpp b/lib/Analysis/LoadValueNumbering.cpp index bbb1e1e1b0d..f99ebb4a83d 100644 --- a/lib/Analysis/LoadValueNumbering.cpp +++ b/lib/Analysis/LoadValueNumbering.cpp @@ -82,14 +82,15 @@ namespace { void getCallEqualNumberNodes(CallInst *CI, std::vector &RetVals) const; }; +} - char LoadVN::ID = 0; - // Register this pass... - RegisterPass X("load-vn", "Load Value Numbering", false, true); +char LoadVN::ID = 0; +// Register this pass... +static RegisterPass +X("load-vn", "Load Value Numbering", false, true); - // Declare that we implement the ValueNumbering interface - RegisterAnalysisGroup Y(X); -} +// Declare that we implement the ValueNumbering interface +static RegisterAnalysisGroup Y(X); FunctionPass *llvm::createLoadValueNumberingPass() { return new LoadVN(); } @@ -116,9 +117,9 @@ static bool isPathTransparentTo(BasicBlock *CurBlock, BasicBlock *Dom, // Check whether this block is known transparent or not. std::map::iterator TBI = - TransparentBlocks.lower_bound(CurBlock); + TransparentBlocks.find(CurBlock); - if (TBI == TransparentBlocks.end() || TBI->first != CurBlock) { + if (TBI == TransparentBlocks.end()) { // If this basic block can modify the memory location, then the path is not // transparent! if (AA.canBasicBlockModify(*CurBlock, Ptr, Size)) { @@ -157,10 +158,10 @@ void LoadVN::getCallEqualNumberNodes(CallInst *CI, // global. In particular, we would prefer to have an argument or instruction // operand to chase the def-use chains of. Value *Op = CF; - for (unsigned i = 1, e = CI->getNumOperands(); i != e; ++i) - if (isa(CI->getOperand(i)) || - isa(CI->getOperand(i))) { - Op = CI->getOperand(i); + for (User::op_iterator i = CI->op_begin() + 1, e = CI->op_end(); i != e; ++i) + if (isa(*i) || + isa(*i)) { + Op = *i; break; } @@ -175,8 +176,9 @@ void LoadVN::getCallEqualNumberNodes(CallInst *CI, C->getOperand(0) == CI->getOperand(0) && C->getParent()->getParent() == CIFunc && C != CI) { bool AllOperandsEqual = true; - for (unsigned i = 1, e = CI->getNumOperands(); i != e; ++i) - if (C->getOperand(i) != CI->getOperand(i)) { + for (User::op_iterator i = CI->op_begin() + 1, j = C->op_begin() + 1, + e = CI->op_end(); i != e; ++i, ++j) + if (*j != *i) { AllOperandsEqual = false; break; }