forked from OSchip/llvm-project
[JumpThreading] Use emplace_back instead of push_back (NFC)
Summary: This patch replaces push_back with emplace_back where appropriate. Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D80688
This commit is contained in:
parent
4954449995
commit
c4990a03c6
|
@ -616,7 +616,7 @@ bool JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(
|
||||||
// If V is a constant, then it is known in all predecessors.
|
// If V is a constant, then it is known in all predecessors.
|
||||||
if (Constant *KC = getKnownConstant(V, Preference)) {
|
if (Constant *KC = getKnownConstant(V, Preference)) {
|
||||||
for (BasicBlock *Pred : predecessors(BB))
|
for (BasicBlock *Pred : predecessors(BB))
|
||||||
Result.push_back(std::make_pair(KC, Pred));
|
Result.emplace_back(KC, Pred);
|
||||||
|
|
||||||
return !Result.empty();
|
return !Result.empty();
|
||||||
}
|
}
|
||||||
|
@ -643,7 +643,7 @@ bool JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(
|
||||||
// predecessor, use that information to try to thread this block.
|
// predecessor, use that information to try to thread this block.
|
||||||
Constant *PredCst = LVI->getConstantOnEdge(V, P, BB, CxtI);
|
Constant *PredCst = LVI->getConstantOnEdge(V, P, BB, CxtI);
|
||||||
if (Constant *KC = getKnownConstant(PredCst, Preference))
|
if (Constant *KC = getKnownConstant(PredCst, Preference))
|
||||||
Result.push_back(std::make_pair(KC, P));
|
Result.emplace_back(KC, P);
|
||||||
}
|
}
|
||||||
|
|
||||||
return !Result.empty();
|
return !Result.empty();
|
||||||
|
@ -654,13 +654,13 @@ bool JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(
|
||||||
for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) {
|
for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) {
|
||||||
Value *InVal = PN->getIncomingValue(i);
|
Value *InVal = PN->getIncomingValue(i);
|
||||||
if (Constant *KC = getKnownConstant(InVal, Preference)) {
|
if (Constant *KC = getKnownConstant(InVal, Preference)) {
|
||||||
Result.push_back(std::make_pair(KC, PN->getIncomingBlock(i)));
|
Result.emplace_back(KC, PN->getIncomingBlock(i));
|
||||||
} else {
|
} else {
|
||||||
Constant *CI = LVI->getConstantOnEdge(InVal,
|
Constant *CI = LVI->getConstantOnEdge(InVal,
|
||||||
PN->getIncomingBlock(i),
|
PN->getIncomingBlock(i),
|
||||||
BB, CxtI);
|
BB, CxtI);
|
||||||
if (Constant *KC = getKnownConstant(CI, Preference))
|
if (Constant *KC = getKnownConstant(CI, Preference))
|
||||||
Result.push_back(std::make_pair(KC, PN->getIncomingBlock(i)));
|
Result.emplace_back(KC, PN->getIncomingBlock(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -759,7 +759,7 @@ bool JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(
|
||||||
Constant *Folded = ConstantExpr::get(BO->getOpcode(), V, CI);
|
Constant *Folded = ConstantExpr::get(BO->getOpcode(), V, CI);
|
||||||
|
|
||||||
if (Constant *KC = getKnownConstant(Folded, WantInteger))
|
if (Constant *KC = getKnownConstant(Folded, WantInteger))
|
||||||
Result.push_back(std::make_pair(KC, LHSVal.second));
|
Result.emplace_back(KC, LHSVal.second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -811,7 +811,7 @@ bool JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Constant *KC = getKnownConstant(Res, WantInteger))
|
if (Constant *KC = getKnownConstant(Res, WantInteger))
|
||||||
Result.push_back(std::make_pair(KC, PredBB));
|
Result.emplace_back(KC, PredBB);
|
||||||
}
|
}
|
||||||
|
|
||||||
return !Result.empty();
|
return !Result.empty();
|
||||||
|
@ -834,7 +834,7 @@ bool JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Constant *ResC = ConstantInt::get(CmpType, Res);
|
Constant *ResC = ConstantInt::get(CmpType, Res);
|
||||||
Result.push_back(std::make_pair(ResC, P));
|
Result.emplace_back(ResC, P);
|
||||||
}
|
}
|
||||||
|
|
||||||
return !Result.empty();
|
return !Result.empty();
|
||||||
|
@ -873,7 +873,7 @@ bool JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(
|
||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Result.push_back(std::make_pair(ResC, P));
|
Result.emplace_back(ResC, P);
|
||||||
}
|
}
|
||||||
|
|
||||||
return !Result.empty();
|
return !Result.empty();
|
||||||
|
@ -891,7 +891,7 @@ bool JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(
|
||||||
Constant *V = LHSVal.first;
|
Constant *V = LHSVal.first;
|
||||||
Constant *Folded = ConstantExpr::getCompare(Pred, V, CmpConst);
|
Constant *Folded = ConstantExpr::getCompare(Pred, V, CmpConst);
|
||||||
if (Constant *KC = getKnownConstant(Folded, WantInteger))
|
if (Constant *KC = getKnownConstant(Folded, WantInteger))
|
||||||
Result.push_back(std::make_pair(KC, LHSVal.second));
|
Result.emplace_back(KC, LHSVal.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
return !Result.empty();
|
return !Result.empty();
|
||||||
|
@ -925,7 +925,7 @@ bool JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(
|
||||||
|
|
||||||
// See if the select has a known constant value for this predecessor.
|
// See if the select has a known constant value for this predecessor.
|
||||||
if (Constant *Val = KnownCond ? TrueVal : FalseVal)
|
if (Constant *Val = KnownCond ? TrueVal : FalseVal)
|
||||||
Result.push_back(std::make_pair(Val, C.second));
|
Result.emplace_back(Val, C.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
return !Result.empty();
|
return !Result.empty();
|
||||||
|
@ -936,7 +936,7 @@ bool JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(
|
||||||
Constant *CI = LVI->getConstant(V, BB, CxtI);
|
Constant *CI = LVI->getConstant(V, BB, CxtI);
|
||||||
if (Constant *KC = getKnownConstant(CI, Preference)) {
|
if (Constant *KC = getKnownConstant(CI, Preference)) {
|
||||||
for (BasicBlock *Pred : predecessors(BB))
|
for (BasicBlock *Pred : predecessors(BB))
|
||||||
Result.push_back(std::make_pair(KC, Pred));
|
Result.emplace_back(KC, Pred);
|
||||||
}
|
}
|
||||||
|
|
||||||
return !Result.empty();
|
return !Result.empty();
|
||||||
|
@ -1345,7 +1345,7 @@ bool JumpThreadingPass::SimplifyPartiallyRedundantLoad(LoadInst *LoadI) {
|
||||||
|
|
||||||
// If so, this load is partially redundant. Remember this info so that we
|
// If so, this load is partially redundant. Remember this info so that we
|
||||||
// can create a PHI node.
|
// can create a PHI node.
|
||||||
AvailablePreds.push_back(std::make_pair(PredBB, PredAvailable));
|
AvailablePreds.emplace_back(PredBB, PredAvailable);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the loaded value isn't available in any predecessor, it isn't partially
|
// If the loaded value isn't available in any predecessor, it isn't partially
|
||||||
|
@ -1419,7 +1419,7 @@ bool JumpThreadingPass::SimplifyPartiallyRedundantLoad(LoadInst *LoadI) {
|
||||||
if (AATags)
|
if (AATags)
|
||||||
NewVal->setAAMetadata(AATags);
|
NewVal->setAAMetadata(AATags);
|
||||||
|
|
||||||
AvailablePreds.push_back(std::make_pair(UnavailablePred, NewVal));
|
AvailablePreds.emplace_back(UnavailablePred, NewVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now we know that each predecessor of this block has a value in
|
// Now we know that each predecessor of this block has a value in
|
||||||
|
@ -1652,7 +1652,7 @@ bool JumpThreadingPass::ProcessThreadableEdges(Value *Cond, BasicBlock *BB,
|
||||||
isa<CallBrInst>(Pred->getTerminator()))
|
isa<CallBrInst>(Pred->getTerminator()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
PredToDestList.push_back(std::make_pair(Pred, DestBB));
|
PredToDestList.emplace_back(Pred, DestBB);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If all edges were unthreadable, we fail.
|
// If all edges were unthreadable, we fail.
|
||||||
|
|
Loading…
Reference in New Issue