[PATCH] D118455: [DebugInfo][InstrRef][NFC] Cache some PHI resolutions

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 2 03:09:19 PST 2022


jmorse added inline comments.


================
Comment at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp:3416-3417
     // block as the Def.
+    SeenDbgPHIs.insert({&Here, ValueIDNum::fromU64(AvailIt->second)});
     return ValueIDNum::fromU64(AvailIt->second);
   }
----------------
StephenTozer wrote:
> dblaikie wrote:
> > Given the need to touch every return from this function, and they're fairly spread out - might be good to refactor the non-cache-hit part of the function into another function, call that from the caching version and only have to have one `SeenDbgPHIs.insert` call that then ends up relatively close to the `SeenDbgPHIs` lookup code too?
> > 
> > (& I guess operations in this function invalidate the `SeenDbgPHIs` iterator, otherwise you could use that (possibly even call `insert`) later on to save the extra lookup)
> +1, better readability + prevents someone in the future from adding a new return without the cache insert.
Clearly I was missing a lot of caffeine when writing this patch, this is definitely the right solution.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118455



More information about the llvm-commits mailing list