[PATCH] D111150: [AMDGPU] Remove dead frame indices after sgpr spill.

Mahesha S via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 6 02:58:03 PDT 2021


hsmhsm marked 2 inline comments as done.
hsmhsm added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp:459
 
+  for (auto DFI : DeadFrameIndices)
+    SGPRToVGPRSpills.erase(DFI);
----------------
foad wrote:
> cdevadas wrote:
> > hsmhsm wrote:
> > > cdevadas wrote:
> > > > Isn't it possible to avoid this loop by handling the erase inside the original loop itself?
> > > > Maybe convert the range-based loop above into an iterator-based one?
> > > As I understand it, it does not help. The llvm DensMap<>::erase() function does not return next iterator. So, erasing DensMap entries while iterating it seems to be *not* possible. Please let me know if you have any idea.
> > If erase doesn't return the iterator, better retain this loop. Thanks.
> If you write the loop as `for (auto &R : make_early_inc_range(SGPRToVGPRSpills))` then you can erase R inside the loop.
Thanks Jay. This is a useful LLVM related information that I was not aware of.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111150



More information about the llvm-commits mailing list