Skip to content

Commit 1238378

Browse files
[llvm] Use pop_back_val (NFC)
1 parent cc7a238 commit 1238378

File tree

10 files changed

+13
-26
lines changed

10 files changed

+13
-26
lines changed

llvm/lib/Transforms/Coroutines/CoroFrame.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -913,8 +913,7 @@ struct AllocaUseVisitor : PtrUseVisitor<AllocaUseVisitor> {
913913
// StoreAliases contains aliases of the memory location stored into.
914914
SmallVector<Instruction *, 4> StoreAliases = {AI};
915915
while (!StoreAliases.empty()) {
916-
Instruction *I = StoreAliases.back();
917-
StoreAliases.pop_back();
916+
Instruction *I = StoreAliases.pop_back_val();
918917
for (User *U : I->users()) {
919918
// If we are loading from the memory location, we are creating an
920919
// alias of the original pointer.
@@ -2005,8 +2004,7 @@ static void sinkSpillUsesAfterCoroBegin(Function &F,
20052004
}
20062005
// Recursively collect users before coro.begin.
20072006
while (!Worklist.empty()) {
2008-
auto *Def = Worklist.back();
2009-
Worklist.pop_back();
2007+
auto *Def = Worklist.pop_back_val();
20102008
for (User *U : Def->users()) {
20112009
auto Inst = cast<Instruction>(U);
20122010
if (Dom.dominates(CoroBegin, Inst))

llvm/lib/Transforms/IPO/ArgumentPromotion.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -824,8 +824,7 @@ static bool canPaddingBeAccessed(Argument *arg) {
824824
// sanely.
825825
SmallVector<Value *, 16> WorkList(arg->users());
826826
while (!WorkList.empty()) {
827-
Value *V = WorkList.back();
828-
WorkList.pop_back();
827+
Value *V = WorkList.pop_back_val();
829828
if (isa<GetElementPtrInst>(V) || isa<PHINode>(V)) {
830829
if (PtrValues.insert(V).second)
831830
llvm::append_range(WorkList, V->users());

llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,8 +507,7 @@ void Formula::canonicalize(const Loop &L) {
507507

508508
// Keep the invariant sum in BaseRegs and one of the variant sum in ScaledReg.
509509
if (!ScaledReg) {
510-
ScaledReg = BaseRegs.back();
511-
BaseRegs.pop_back();
510+
ScaledReg = BaseRegs.pop_back_val();
512511
Scale = 1;
513512
}
514513

llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -531,8 +531,7 @@ class LowerMatrixIntrinsics {
531531
// list.
532532
LLVM_DEBUG(dbgs() << "Forward-propagate shapes:\n");
533533
while (!WorkList.empty()) {
534-
Instruction *Inst = WorkList.back();
535-
WorkList.pop_back();
534+
Instruction *Inst = WorkList.pop_back_val();
536535

537536
// New entry, set the value and insert operands
538537
bool Propagate = false;
@@ -602,8 +601,7 @@ class LowerMatrixIntrinsics {
602601
// worklist.
603602
LLVM_DEBUG(dbgs() << "Backward-propagate shapes:\n");
604603
while (!WorkList.empty()) {
605-
Value *V = WorkList.back();
606-
WorkList.pop_back();
604+
Value *V = WorkList.pop_back_val();
607605

608606
size_t BeforeProcessingV = WorkList.size();
609607
if (!isa<Instruction>(V))

llvm/lib/Transforms/Scalar/NewGVN.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2876,8 +2876,7 @@ void NewGVN::cleanupTables() {
28762876
}
28772877

28782878
while (!TempInst.empty()) {
2879-
auto *I = TempInst.back();
2880-
TempInst.pop_back();
2879+
auto *I = TempInst.pop_back_val();
28812880
I->deleteValue();
28822881
}
28832882

llvm/lib/Transforms/Scalar/Reassociate.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,8 +1128,7 @@ static Value *EmitAddTreeOfValues(Instruction *I,
11281128
SmallVectorImpl<WeakTrackingVH> &Ops) {
11291129
if (Ops.size() == 1) return Ops.back();
11301130

1131-
Value *V1 = Ops.back();
1132-
Ops.pop_back();
1131+
Value *V1 = Ops.pop_back_val();
11331132
Value *V2 = EmitAddTreeOfValues(I, Ops);
11341133
return CreateAdd(V2, V1, "reass.add", I, I);
11351134
}

llvm/lib/Transforms/Scalar/SCCP.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,8 +1448,7 @@ void SCCPSolver::Solve() {
14481448

14491449
// Process the basic block work list.
14501450
while (!BBWorkList.empty()) {
1451-
BasicBlock *BB = BBWorkList.back();
1452-
BBWorkList.pop_back();
1451+
BasicBlock *BB = BBWorkList.pop_back_val();
14531452

14541453
LLVM_DEBUG(dbgs() << "\nPopped off BBWL: " << *BB << '\n');
14551454

llvm/lib/Transforms/Utils/FixIrreducible.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,7 @@ static bool FixIrreducibleImpl(Function &F, LoopInfo &LI, DominatorTree &DT) {
320320
append_range(WorkList, LI);
321321

322322
while (!WorkList.empty()) {
323-
auto L = WorkList.back();
324-
WorkList.pop_back();
323+
auto L = WorkList.pop_back_val();
325324
LLVM_DEBUG(dbgs() << "visiting loop with header "
326325
<< L->getHeader()->getName() << "\n");
327326
Changed |= makeReducible(LI, DT, *L);

llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,7 @@ static bool processHeaderPhiOperands(BasicBlock *Header, BasicBlock *Latch,
148148
}
149149

150150
while (!Worklist.empty()) {
151-
Instruction *I = Worklist.back();
152-
Worklist.pop_back();
151+
Instruction *I = Worklist.pop_back_val();
153152
if (!Visit(I))
154153
return false;
155154

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5164,8 +5164,7 @@ BoUpSLP::BlockScheduling::tryScheduleBundle(ArrayRef<Value *> VL, BoUpSLP *SLP,
51645164
// cancelScheduling).
51655165
while (!Bundle->isReady() && !ReadyInsts.empty()) {
51665166

5167-
ScheduleData *pickedSD = ReadyInsts.back();
5168-
ReadyInsts.pop_back();
5167+
ScheduleData *pickedSD = ReadyInsts.pop_back_val();
51695168

51705169
if (pickedSD->isSchedulingEntity() && pickedSD->isReady()) {
51715170
schedule(pickedSD, ReadyInsts);
@@ -5338,8 +5337,7 @@ void BoUpSLP::BlockScheduling::calculateDependencies(ScheduleData *SD,
53385337
WorkList.push_back(SD);
53395338

53405339
while (!WorkList.empty()) {
5341-
ScheduleData *SD = WorkList.back();
5342-
WorkList.pop_back();
5340+
ScheduleData *SD = WorkList.pop_back_val();
53435341

53445342
ScheduleData *BundleMember = SD;
53455343
while (BundleMember) {

0 commit comments

Comments
 (0)