[llvm] [MachineOutliner] Preserve regmasks in calls to outlined functions (PR #120940)

Zhaoxuan Jiang via llvm-commits llvm-commits at lists.llvm.org
Wed May 14 03:59:17 PDT 2025


================
@@ -1130,6 +1131,12 @@ bool MachineOutliner::outline(
           MachineInstr *MI = &*Iter;
           SmallSet<Register, 2> InstrUseRegs;
           for (MachineOperand &MOP : MI->operands()) {
+            // Collect all regmasks. Merge them in the end.
+            if (MOP.isRegMask()) {
----------------
nocchijiang wrote:

If we need to mark registers from def operands in the mask, I have a follow-up question: should we drop all the def operands in favor of using regmask, or should we add the masked registers to the def list as well? My understanding is that regmask and def operands serve different purposes - regmask is primarily used to describe calling conventions, while def operands provide additional information specific to the callee. Including all defs in the regmask seems redundant to me. Could anyone clarify the intended distinction between these two, or share best practices for handling this case?

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


More information about the llvm-commits mailing list