[PATCH] D96386: [AMDGPU] Fix promote alloca with double use in a same insn

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 9 18:08:08 PST 2021


rampitec added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp:603-608
+    auto UI = llvm::find(WorkList, User);
+    if (UI != WorkList.end()) {
+      WorkList.erase(UI);
+      WorkList.push_back(User);
       continue;
+    }
----------------
arsenm wrote:
> I don't see how this sorts it, the ordering is still determined by the arbitrary ordering in users. Can't the replacement just check all candidate operands
The function is recursive and does DFS. This code pushes any later use to the end.

Checking all uses at replacement is practically impossible because it may be a long use-def chain. You would need to do DFS again at every replacement.


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

https://reviews.llvm.org/D96386



More information about the llvm-commits mailing list