mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-19 18:24:00 +00:00
[C++11] Add predecessors(BasicBlock *) / successors(BasicBlock *) iterator ranges.
Summary: This patch introduces two new iterator ranges and updates existing code to use it. No functional change intended. Test Plan: All tests (make check-all) still pass. Reviewers: dblaikie Reviewed By: dblaikie Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D4481 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213474 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -353,8 +353,8 @@ ComputeValueKnownInPredecessors(Value *V, BasicBlock *BB, PredValueInfo &Result,
|
||||
|
||||
// If V is a constant, then it is known in all predecessors.
|
||||
if (Constant *KC = getKnownConstant(V, Preference)) {
|
||||
for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; ++PI)
|
||||
Result.push_back(std::make_pair(KC, *PI));
|
||||
for (BasicBlock *Pred : predecessors(BB))
|
||||
Result.push_back(std::make_pair(KC, Pred));
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -377,8 +377,7 @@ ComputeValueKnownInPredecessors(Value *V, BasicBlock *BB, PredValueInfo &Result,
|
||||
// "X < 4" and "X < 3" is known true but "X < 4" itself is not available.
|
||||
// Perhaps getConstantOnEdge should be smart enough to do this?
|
||||
|
||||
for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; ++PI) {
|
||||
BasicBlock *P = *PI;
|
||||
for (BasicBlock *P : predecessors(BB)) {
|
||||
// If the value is known by LazyValueInfo to be a constant in a
|
||||
// predecessor, use that information to try to thread this block.
|
||||
Constant *PredCst = LVI->getConstantOnEdge(V, P, BB);
|
||||
@ -532,8 +531,7 @@ ComputeValueKnownInPredecessors(Value *V, BasicBlock *BB, PredValueInfo &Result,
|
||||
cast<Instruction>(Cmp->getOperand(0))->getParent() != BB) {
|
||||
Constant *RHSCst = cast<Constant>(Cmp->getOperand(1));
|
||||
|
||||
for (pred_iterator PI = pred_begin(BB), E = pred_end(BB);PI != E; ++PI){
|
||||
BasicBlock *P = *PI;
|
||||
for (BasicBlock *P : predecessors(BB)) {
|
||||
// If the value is known by LazyValueInfo to be a constant in a
|
||||
// predecessor, use that information to try to thread this block.
|
||||
LazyValueInfo::Tristate Res =
|
||||
@ -606,8 +604,8 @@ ComputeValueKnownInPredecessors(Value *V, BasicBlock *BB, PredValueInfo &Result,
|
||||
// If all else fails, see if LVI can figure out a constant value for us.
|
||||
Constant *CI = LVI->getConstant(V, BB);
|
||||
if (Constant *KC = getKnownConstant(CI, Preference)) {
|
||||
for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; ++PI)
|
||||
Result.push_back(std::make_pair(KC, *PI));
|
||||
for (BasicBlock *Pred : predecessors(BB))
|
||||
Result.push_back(std::make_pair(KC, Pred));
|
||||
}
|
||||
|
||||
return !Result.empty();
|
||||
@ -899,10 +897,7 @@ bool JumpThreading::SimplifyPartiallyRedundantLoad(LoadInst *LI) {
|
||||
|
||||
// If we got here, the loaded value is transparent through to the start of the
|
||||
// block. Check to see if it is available in any of the predecessor blocks.
|
||||
for (pred_iterator PI = pred_begin(LoadBB), PE = pred_end(LoadBB);
|
||||
PI != PE; ++PI) {
|
||||
BasicBlock *PredBB = *PI;
|
||||
|
||||
for (BasicBlock *PredBB : predecessors(LoadBB)) {
|
||||
// If we already scanned this predecessor, skip it.
|
||||
if (!PredsScanned.insert(PredBB))
|
||||
continue;
|
||||
@ -952,9 +947,7 @@ bool JumpThreading::SimplifyPartiallyRedundantLoad(LoadInst *LI) {
|
||||
AvailablePredSet.insert(AvailablePreds[i].first);
|
||||
|
||||
// Add all the unavailable predecessors to the PredsToSplit list.
|
||||
for (pred_iterator PI = pred_begin(LoadBB), PE = pred_end(LoadBB);
|
||||
PI != PE; ++PI) {
|
||||
BasicBlock *P = *PI;
|
||||
for (BasicBlock *P : predecessors(LoadBB)) {
|
||||
// If the predecessor is an indirect goto, we can't split the edge.
|
||||
if (isa<IndirectBrInst>(P->getTerminator()))
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user