[llvm] [TargetInstrInfo] enable foldMemoryOperand for InlineAsm (PR #70743)

via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 7 09:50:28 PST 2023


================
@@ -565,6 +565,64 @@ static MachineInstr *foldPatchpoint(MachineFunction &MF, MachineInstr &MI,
   return NewMI;
 }
 
+static void foldInlineAsmMemOperand(MachineInstr *MI, unsigned OpNo, int FI,
+                                    const TargetInstrInfo &TII) {
+  MachineOperand &MO = MI->getOperand(OpNo);
+  const VirtRegInfo &RI = AnalyzeVirtRegInBundle(*MI, MO.getReg());
+
+  // If the machine operand is tied, untie it first.
+  if (MO.isTied()) {
+    unsigned TiedTo = MI->findTiedOperandIdx(OpNo);
+    MI->untieRegOperand(OpNo);
----------------
qcolombet wrote:

Note: A safe temporary solution could be to disallow the folding (i.e., use the `m` variant only) for tied operands.

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


More information about the llvm-commits mailing list