[llvm] [AMDGPU] Adding multiple use analysis to SIPeepholeSDWA (PR #94800)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 7 13:33:55 PDT 2024


================
@@ -327,7 +336,37 @@ uint64_t SDWASrcOperand::getSrcMods(const SIInstrInfo *TII,
   return Mods;
 }
 
-MachineInstr *SDWASrcOperand::potentialToConvert(const SIInstrInfo *TII) {
+MachineInstr *SDWASrcOperand::potentialToConvert(const SIInstrInfo *TII,
+                                                 const GCNSubtarget &ST,
+                                                 SDWAOperandsMap *PotentialMatches) {
+  // If PotentialMatches is not null, then fill out the map for all uses,
+  // if all can be converted
+  if (PotentialMatches != nullptr) {
+    MachineOperand *Reg = getReplacedOperand();
+    if (!Reg->isReg() || !Reg->isDef()) {
+      return nullptr;
+    }
+
+    for (MachineOperand &UseMO : getMRI()->use_nodbg_operands(Reg->getReg())) {
----------------
arsenm wrote:

use instructions instead of operands? You do the full instruction legality check 

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


More information about the llvm-commits mailing list