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

Scott Egerton via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 24 09:22:15 PDT 2024


================
@@ -83,26 +84,13 @@ class AMDGPUInsertSingleUseVDST : public MachineFunctionPass {
         // instruction to be marked as a single use producer.
         bool AllProducerOperandsAreSingleUse = true;
 
-        for (const auto &Operand : MI.operands()) {
-          if (!Operand.isReg())
-            continue;
-          const auto Reg = Operand.getReg();
-
-          // Count the number of times each register is read.
-          if (Operand.readsReg())
-            for (const MCRegUnit &Unit : TRI->regunits(Reg))
-              RegisterUseCount[Unit]++;
+        // Gather a list of Registers used before updating use counts to avoid
----------------
ScottEgerton wrote:

Thanks for the feedback.
> Is this just building a map from regunit to a 0-1-or-2 counter?
Escentially, yes. We are counting the uses but the only values we care about are 0, 1 or >1.

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


More information about the llvm-commits mailing list