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

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 6 03:10:25 PDT 2021


foad added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp:454
       MFI.RemoveStackObject(R.first);
+      SGPRToVGPRSpills.erase(R.first);
+    }
----------------
hsmhsm wrote:
> foad wrote:
> > erase(R) should be slightly more efficient as it does not have to do another lookup in the map.
> DenseMap<>::erase() (overloaded) functions takes either key or iterator as arguments. Here R is neither key nor iterator. It is an item (key value pair).
> 
> https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/ADT/DenseMap.h#L302
Oh yes, you're right. So it would be slightly more efficient to use an iterator-based for loop, but neater to use a range-based for loop! I don't mind which you choose.


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