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

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 30 10:32:11 PDT 2019


xbolva00 added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/Local.cpp:2232
+    //skip reachable basic blocks
+    if (Reachable.find(BB)!=Reachable.end())
       continue;
----------------
rcorcs wrote:
> 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.
I am fine with this (and I like find version more than count version).


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