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

Mahesha S via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 5 23:44:27 PDT 2021


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


================
Comment at: llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp:451
+  // freed frame indices by later pass(es) like "stack slot coloring".
+  std::set<int> DeadFrameIndices;
   for (auto &R : SGPRToVGPRSpills) {
----------------
rampitec wrote:
> DenseSet, avoid std:: when possible.
Will update it soon.


================
Comment at: llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp:459
 
+  for (auto DFI : DeadFrameIndices)
+    SGPRToVGPRSpills.erase(DFI);
----------------
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.


================
Comment at: llvm/test/CodeGen/AMDGPU/sgpr-spill-incorrect-fi-bookkeeping-bug.ll:11
+entry:
+  %0 = load i64, i64 addrspace(4)* undef, align 8
+  %1 = inttoptr i64 %0 to i8*
----------------
cdevadas wrote:
> Can you avoid all the unnamed variables?
> 
I am coming up with altogether a different lit test. Will update it soon.


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