[llvm] [MachineOutliner] Preserve regmasks in calls to outlined functions (PR #120940)
Ellis Hoag via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 26 10:18:40 PST 2024
================
@@ -1153,6 +1160,24 @@ bool MachineOutliner::outline(
MI->getMF()->eraseCallSiteInfo(MI);
}
+ if (!RegMasks.empty()) {
+ if (RegMasks.size() == 1) {
+ CallInst->addOperand(
+ MachineOperand::CreateRegMask(*RegMasks.begin()));
+ } else {
+ uint32_t *RegMask = MF->allocateRegMask();
+ unsigned NumRegs =
+ MF->getSubtarget().getRegisterInfo()->getNumRegs();
+ unsigned Size = MachineOperand::getRegMaskSize(NumRegs);
+ memset(RegMask, UINT32_MAX, Size * sizeof(RegMask[0]));
+ for (const uint32_t *Mask : RegMasks) {
+ for (unsigned I = 0; I < Size; ++I)
+ RegMask[I] &= Mask[I];
+ }
----------------
ellishg wrote:
```suggestion
for (const uint32_t *Mask : RegMasks)
for (unsigned I = 0; I < Size; ++I)
RegMask[I] &= Mask[I];
```
https://github.com/llvm/llvm-project/pull/120940
More information about the llvm-commits
mailing list