[PATCH] D51519: [SimpleLoopUnswitch] remove a chain of dead blocks at once
Alina Sbirlea via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 30 16:32:06 PDT 2018
asbirlea added inline comments.
================
Comment at: lib/Transforms/Scalar/SimpleLoopUnswitch.cpp:1387
+ ExitBlocks.end());
+ for (Loop *ParentL = &L; ParentL; ParentL = ParentL->getParentLoop()) {
+ DeathCandidates.append(ParentL->blocks().begin(), ParentL->blocks().end());
----------------
Do we need to go over all parent loops now? Processing the successors of each block in DeathCandidates may be enough. It at least resolves testcase `delete-dead-blocks.ll` which motivated processing blocks in parent loops.
================
Comment at: lib/Transforms/Scalar/SimpleLoopUnswitch.cpp:1389
+ DeathCandidates.append(ParentL->blocks().begin(), ParentL->blocks().end());
+ while (!DeathCandidates.empty()) {
+ auto *BB = DeathCandidates.pop_back_val();
----------------
Could we pull the while outside the for loop?
And populate the initial DeathCandidates with ExitBlocks and loop blocks?
Repository:
rL LLVM
https://reviews.llvm.org/D51519
More information about the llvm-commits
mailing list