File tree Expand file tree Collapse file tree 3 files changed +12
-8
lines changed Expand file tree Collapse file tree 3 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -1168,6 +1168,8 @@ class LLVM_ABI MachineFunction {
11681168 // / Allocate and initialize a register mask with @p NumRegister bits.
11691169 uint32_t *allocateRegMask ();
11701170
1171+ MutableArrayRef<uint32_t > allocateRegMaskArray ();
1172+
11711173 ArrayRef<int > allocateShuffleMask (ArrayRef<int > Mask);
11721174
11731175 // / Allocate and construct an extra info structure for a `MachineInstr`.
Original file line number Diff line number Diff line change @@ -620,11 +620,15 @@ const char *MachineFunction::createExternalSymbolName(StringRef Name) {
620620}
621621
622622uint32_t *MachineFunction::allocateRegMask () {
623+ return allocateRegMaskArray ().data ();
624+ }
625+
626+ MutableArrayRef<uint32_t > MachineFunction::allocateRegMaskArray () {
623627 unsigned NumRegs = getSubtarget ().getRegisterInfo ()->getNumRegs ();
624628 unsigned Size = MachineOperand::getRegMaskSize (NumRegs);
625629 uint32_t *Mask = Allocator.Allocate <uint32_t >(Size);
626630 memset (Mask, 0 , Size * sizeof (Mask[0 ]));
627- return Mask;
631+ return { Mask, Size} ;
628632}
629633
630634ArrayRef<int > MachineFunction::allocateShuffleMask (ArrayRef<int > Mask) {
Original file line number Diff line number Diff line change @@ -1165,15 +1165,13 @@ bool MachineOutliner::outline(
11651165 CallInst->addOperand (
11661166 MachineOperand::CreateRegMask (*RegMasks.begin ()));
11671167 } else {
1168- uint32_t *RegMask = MF->allocateRegMask ();
1169- unsigned NumRegs =
1170- MF->getSubtarget ().getRegisterInfo ()->getNumRegs ();
1171- unsigned Size = MachineOperand::getRegMaskSize (NumRegs);
1172- memset (RegMask, UINT32_MAX, Size * sizeof (RegMask[0 ]));
1168+ auto RegMask = MF->allocateRegMaskArray ();
1169+ for (unsigned I = 0 ; I < RegMask.size (); ++I)
1170+ RegMask[I] = UINT32_MAX;
11731171 for (const uint32_t *Mask : RegMasks)
1174- for (unsigned I = 0 ; I < Size ; ++I)
1172+ for (unsigned I = 0 ; I < RegMask. size () ; ++I)
11751173 RegMask[I] &= Mask[I];
1176- CallInst->addOperand (MachineOperand::CreateRegMask (RegMask));
1174+ CallInst->addOperand (MachineOperand::CreateRegMask (RegMask. data () ));
11771175 }
11781176 }
11791177
You can’t perform that action at this time.
0 commit comments