[PATCH] D68191: Simplify function llvm::removeUnreachableBlocks() to avoid (re-)computation.

Rodrigo Caetano Rocha via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 30 10:13:14 PDT 2019


rcorcs marked an inline comment as done.
rcorcs added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/Local.cpp:2232
+    //skip reachable basic blocks
+    if (Reachable.find(BB)!=Reachable.end())
       continue;
----------------
xbolva00 wrote:
> xbolva00 wrote:
> > Since Reachable is SmallPtrSet, count should be as good as find()
> > 
> > https://github.com/llvm-mirror/llvm/blob/master/include/llvm/ADT/SmallPtrSet.h#L381
> Please “clang format” this patch
Indeed they have the same complexity. I prefer find() because it conveys a better idea of what is being done and its complexity, but I don't have a strong opinion about that. If you prefer, I can roll back to using count() instead.


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