[PATCH] D94981: [LiveDebugVariables] Add cache for SkipPHIsLabelsAndDebug to prevent iterating the same set of PHI/LABEL/Debug instructions repeatedly.

Wei Mi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 28 17:38:34 PST 2021


wmi added inline comments.


================
Comment at: llvm/lib/CodeGen/LiveDebugVariables.cpp:1311-1312
+      // Note the iterator kept in BBSkipInstsMap is either the iterator
+      // before the one returned by SkipPHIsLabelsAndDebug last time,
+      // or MBB->begin(). We need to keep one iterator before the
+      // iterator returned by SkipPHIsLabelsAndDebug because there may be
----------------
dblaikie wrote:
> Is this comment incorrect? It sounds like from your other comments that MBB->begin() is never in the map?
Good catch. Will fix it.


================
Comment at: llvm/lib/CodeGen/LiveDebugVariables.cpp:1327
+      auto I = MBB->SkipPHIsLabelsAndDebug(BeginIt);
+      if (I != MBB->begin())
+        BBSkipInstsMap[MBB] = std::prev(I);
----------------
dblaikie wrote:
> I guess this could be `I != BeginIt` - could save updates when the search doesn't find a new spot? & might be marginally cheaper comparison than calling begin() again?
That is better. Thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94981



More information about the llvm-commits mailing list