[PATCH] D106720: [Attributor] AAFunctionReachability, Instruction reachability.

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 24 07:50:23 PDT 2021


jdoerfert added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/AttributorAttributes.cpp:9468-9470
+      for (auto It = Set.Unreachable.begin(); It != Set.Unreachable.end();) {
+        Function *Fn = *It;
+        It++;
----------------
kuter wrote:
> jdoerfert wrote:
> > Why no range loop?
> `markReachable` call below erases `Fn` from the set we are iterating right now.
> I increment the iterator before processing  `Fn` in case `Fn` gets removed from the `Unreachable` set.
> 
> It would be invalid to increment the iterator if Fn was already deleted right ? I think we have to do that before.
I see. We have a special iterator + range loop for that, maybe you want to look at `make_early_inc_range` and it's uses.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106720/new/

https://reviews.llvm.org/D106720



More information about the llvm-commits mailing list