diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2018-06-15 21:06:43 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2018-06-15 21:06:43 +0000 |
commit | 7f68a309ac68d43752ffe5e543fe03c4d4e2a989 (patch) | |
tree | c779e79f9dfc6cf573bd90cef2589fcd9d9e15ee /llvm/lib/Analysis/BranchProbabilityInfo.cpp | |
parent | 668dd03c8dc00f5827a7b53813508d71c41aba30 (diff) | |
download | bcm5719-llvm-7f68a309ac68d43752ffe5e543fe03c4d4e2a989.tar.gz bcm5719-llvm-7f68a309ac68d43752ffe5e543fe03c4d4e2a989.zip |
[BPI] Remove unnecessary std::list
vector is sufficient here. No functionality change intended.
llvm-svn: 334865
Diffstat (limited to 'llvm/lib/Analysis/BranchProbabilityInfo.cpp')
-rw-r--r-- | llvm/lib/Analysis/BranchProbabilityInfo.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/Analysis/BranchProbabilityInfo.cpp b/llvm/lib/Analysis/BranchProbabilityInfo.cpp index 1a4fc0465bb..54a657073f0 100644 --- a/llvm/lib/Analysis/BranchProbabilityInfo.cpp +++ b/llvm/lib/Analysis/BranchProbabilityInfo.cpp @@ -500,13 +500,13 @@ computeUnlikelySuccessors(const BasicBlock *BB, Loop *L, PHINode *CmpPHI = dyn_cast<PHINode>(CmpLHS); Constant *CmpConst = dyn_cast<Constant>(CI->getOperand(1)); // Collect the instructions until we hit a PHI - std::list<BinaryOperator*> InstChain; + SmallVector<BinaryOperator *, 1> InstChain; while (!CmpPHI && CmpLHS && isa<BinaryOperator>(CmpLHS) && isa<Constant>(CmpLHS->getOperand(1))) { // Stop if the chain extends outside of the loop if (!L->contains(CmpLHS)) return; - InstChain.push_front(dyn_cast<BinaryOperator>(CmpLHS)); + InstChain.push_back(cast<BinaryOperator>(CmpLHS)); CmpLHS = dyn_cast<Instruction>(CmpLHS->getOperand(0)); if (CmpLHS) CmpPHI = dyn_cast<PHINode>(CmpLHS); @@ -542,10 +542,9 @@ computeUnlikelySuccessors(const BasicBlock *BB, Loop *L, std::find(succ_begin(BB), succ_end(BB), B) == succ_end(BB)) continue; // First collapse InstChain - for (Instruction *I : InstChain) { + for (Instruction *I : llvm::reverse(InstChain)) { CmpLHSConst = ConstantExpr::get(I->getOpcode(), CmpLHSConst, - dyn_cast<Constant>(I->getOperand(1)), - true); + cast<Constant>(I->getOperand(1)), true); if (!CmpLHSConst) break; } |