Skip to content

Commit 7ffc78b

Browse files
committed
Use pre-increment operator--() instead of post-increment as former
doesnt dereference allowing it to work when iterator is pointing to end of list Change-Id: I33a246c22ee444ca585dcbd8062ea4b27ad7eb38
1 parent c05b5f2 commit 7ffc78b

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

visa/RegAlloc.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2702,17 +2702,10 @@ void LivenessAnalysis::computeGenKillandPseudoKill(G4_BB* bb,
27022702
for (auto&& pseudoKill : pseudoKills)
27032703
{
27042704
INST_LIST_ITER iterToInsert = pseudoKill.second.base();
2705-
if (iterToInsert == bb->end())
2705+
do
27062706
{
2707-
std::advance(iterToInsert, -1);
2708-
}
2709-
else
2710-
{
2711-
do
2712-
{
2713-
iterToInsert--;
2714-
} while ((*iterToInsert)->isPseudoKill());
2715-
}
2707+
--iterToInsert;
2708+
} while ((*iterToInsert)->isPseudoKill());
27162709
G4_INST* killInst = fg.builder->createPseudoKill(pseudoKill.first);
27172710
bb->insert(iterToInsert, killInst);
27182711
}

0 commit comments

Comments
 (0)