[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:
Kazu Hirata 2020-05-27 22:30:10 -07:00
parent 4954449995
commit c4990a03c6
1 changed files with 14 additions and 14 deletions

View File

@ -616,7 +616,7 @@ bool JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(
// If V is a constant, then it is known in all predecessors.
if (Constant *KC = getKnownConstant(V, Preference)) {
for (BasicBlock *Pred : predecessors(BB))
Result.push_back(std::make_pair(KC, Pred));
Result.emplace_back(KC, Pred);
return !Result.empty();
}
@ -643,7 +643,7 @@ bool JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(
// predecessor, use that information to try to thread this block.
Constant *PredCst = LVI->getConstantOnEdge(V, P, BB, CxtI);
if (Constant *KC = getKnownConstant(PredCst, Preference))
Result.push_back(std::make_pair(KC, P));
Result.emplace_back(KC, P);
}
return !Result.empty();
@ -654,13 +654,13 @@ bool JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(
for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) {
Value *InVal = PN->getIncomingValue(i);
if (Constant *KC = getKnownConstant(InVal, Preference)) {
Result.push_back(std::make_pair(KC, PN->getIncomingBlock(i)));
Result.emplace_back(KC, PN->getIncomingBlock(i));
} else {
Constant *CI = LVI->getConstantOnEdge(InVal,
PN->getIncomingBlock(i),
BB, CxtI);
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);
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))
Result.push_back(std::make_pair(KC, PredBB));
Result.emplace_back(KC, PredBB);
}
return !Result.empty();
@ -834,7 +834,7 @@ bool JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(
continue;
Constant *ResC = ConstantInt::get(CmpType, Res);
Result.push_back(std::make_pair(ResC, P));
Result.emplace_back(ResC, P);
}
return !Result.empty();
@ -873,7 +873,7 @@ bool JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(
else
continue;
Result.push_back(std::make_pair(ResC, P));
Result.emplace_back(ResC, P);
}
return !Result.empty();
@ -891,7 +891,7 @@ bool JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(
Constant *V = LHSVal.first;
Constant *Folded = ConstantExpr::getCompare(Pred, V, CmpConst);
if (Constant *KC = getKnownConstant(Folded, WantInteger))
Result.push_back(std::make_pair(KC, LHSVal.second));
Result.emplace_back(KC, LHSVal.second);
}
return !Result.empty();
@ -925,7 +925,7 @@ bool JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(
// See if the select has a known constant value for this predecessor.
if (Constant *Val = KnownCond ? TrueVal : FalseVal)
Result.push_back(std::make_pair(Val, C.second));
Result.emplace_back(Val, C.second);
}
return !Result.empty();
@ -936,7 +936,7 @@ bool JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(
Constant *CI = LVI->getConstant(V, BB, CxtI);
if (Constant *KC = getKnownConstant(CI, Preference)) {
for (BasicBlock *Pred : predecessors(BB))
Result.push_back(std::make_pair(KC, Pred));
Result.emplace_back(KC, Pred);
}
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
// 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
@ -1419,7 +1419,7 @@ bool JumpThreadingPass::SimplifyPartiallyRedundantLoad(LoadInst *LoadI) {
if (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
@ -1652,7 +1652,7 @@ bool JumpThreadingPass::ProcessThreadableEdges(Value *Cond, BasicBlock *BB,
isa<CallBrInst>(Pred->getTerminator()))
continue;
PredToDestList.push_back(std::make_pair(Pred, DestBB));
PredToDestList.emplace_back(Pred, DestBB);
}
// If all edges were unthreadable, we fail.