[PATCH] D68191: Simplify function llvm::removeUnreachableBlocks() to avoid (re-)computation.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 1 03:55:09 PDT 2019
fhahn accepted this revision.
fhahn added a comment.
This revision is now accepted and ready to land.
Nice catch. This should be better overall, as instead of iterating over the whole function to delete dead blocks, we just iterate over the dead blocks. Even more work is skipped in case we have a DTU.
LGTM
================
Comment at: llvm/lib/Transforms/Utils/Local.cpp:2231
auto *BB = &*I;
- if (Reachable.count(BB))
+ // skip reachable basic blocks
+ if (Reachable.find(BB) != Reachable.end())
----------------
In LLVM comments tend to be sentences, i.e. capitalize Skip and add a full stop.
================
Comment at: llvm/lib/Transforms/Utils/Local.cpp:2276
+ } else {
+ for (auto *BB : DeadBlockSet) {
+ BB->eraseFromParent();
----------------
I think most code in LLVM tends to omit unnecessary braces for single statement blocks.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D68191/new/
https://reviews.llvm.org/D68191
More information about the llvm-commits
mailing list