[llvm] [MachineOutliner] Preserve regmasks in calls to outlined functions (PR #120940)
Ellis Hoag via llvm-commits
llvm-commits at lists.llvm.org
Wed May 14 09:45:36 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()) {
----------------
ellishg wrote:
That's a good question. It seems like RegMask and Def/Use registers hold similar information. I think the RegMask is responsible only to tell you which registers are clobbered after an instruction (usually a call). Def/Use registers are required to know which registers to pass as inputs to a function, and which to use a return values.
There is similar code in `FastISel.cpp` where it uses both Def/Use (In/Out) registers and a RegMask.
https://github.com/llvm/llvm-project/blob/9a0e1c79886ed95642b3400c0ec82f8a72d52ff6/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp#L858-L880
https://github.com/llvm/llvm-project/pull/120940
More information about the llvm-commits
mailing list