[PATCH] D114643: [AMDGPU] Aggressively fold immediates in SIFoldOperands

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 17 13:20:54 PDT 2022


arsenm accepted this revision.
arsenm added inline comments.
This revision is now accepted and ready to land.


================
Comment at: llvm/lib/Target/AMDGPU/SIFoldOperands.cpp:1246-1249
+  SmallVector<MachineOperand *, 4> UsesToProcess;
+  for (auto &Use : MRI->use_nodbg_operands(Dst.getReg()))
+    UsesToProcess.push_back(&Use);
+  for (auto U : UsesToProcess) {
----------------
foad wrote:
> sebastian-ne wrote:
> > Can this use `make_early_inc_range` instead of caching the small vector like in the if-case? (if so, this probably makes more sense as an NFC patch afterwards)
> Not sure. I can try that as a follow-up.
The iterators in this pass are kind of a mess. I've wanted to rewrite this pass to work more like how PeepholeOpt works, collecting defs, visiting uses and looking for collected defs. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114643



More information about the llvm-commits mailing list