[llvm] [AMPGPU] Emit s_singleuse_vdst instructions when a register is used multiple times in the same instruction. (PR #89601)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 23 02:09:25 PDT 2024


================
@@ -114,6 +102,22 @@ class AMDGPUInsertSingleUseVDST : public MachineFunctionPass {
           for (const MCRegUnit &Unit : RegUnits)
             RegisterUseCount.erase(Unit);
         }
+
+        for (const auto &Operand : MI.all_uses()) {
+          const auto Reg = Operand.getReg();
+
+          // Count the number of times each register is read.
+          for (const MCRegUnit &Unit : TRI->regunits(Reg))
----------------
arsenm wrote:

RegUnits are simple integers and shouldn't use references 

https://github.com/llvm/llvm-project/pull/89601


More information about the llvm-commits mailing list