[llvm] Try To Guess SGMasks for Inline Asm Instructions (PR #155491)

Patrick Simmons via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 15 09:25:51 PDT 2025


================
@@ -2391,6 +2391,51 @@ bool SchedGroup::canAddMI(const MachineInstr &MI) const {
   if (MI.isMetaInstruction())
     Result = false;
 
+  else if (MI.isInlineAsm()) {
+    const SIRegisterInfo &TRI = TII->getRegisterInfo();
+    auto &MRI = MI.getParent()->getParent()->getRegInfo();
+    bool SGPR_used = false, VGPR_used = false, VMFMA_used = false,
+         MayLoad = MI.mayLoad(), MayStore = MI.mayStore();
+    for (const MachineOperand &Operand : MI.operands())
+      if (Operand.isReg()) {
+        auto &RegClass = *TRI.getRegClassForOperandReg(MRI, Operand);
+        if (TRI.hasVGPRs(&RegClass))
+          VGPR_used = true;
+        if (TRI.hasAGPRs(&RegClass) || TRI.getRegSizeInBits(RegClass) > 128) // > 128 bit registers are usually only used by MFMA instructions, so we're using that as a heuristic to guess the schedule group mask of the inline asm.
----------------
linuxrocks123 wrote:

@arsenm I think it should be, so I changed it.

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


More information about the llvm-commits mailing list