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 @@ -1148,6 +1148,8 @@ class LLVM_ABI MachineFunction {
11481148 // / Allocate and initialize a register mask with @p NumRegister bits.
11491149 uint32_t *allocateRegMask ();
11501150
1151+ MutableArrayRef<uint32_t > allocateRegMaskArray ();
1152+
11511153 ArrayRef<int > allocateShuffleMask (ArrayRef<int > Mask);
11521154
11531155 // / Allocate and construct an extra info structure for a `MachineInstr`.
Original file line number Diff line number Diff line change @@ -623,11 +623,15 @@ const char *MachineFunction::createExternalSymbolName(StringRef Name) {
623623}
624624
625625uint32_t *MachineFunction::allocateRegMask () {
626+ return allocateRegMaskArray ().data ();
627+ }
628+
629+ MutableArrayRef<uint32_t > MachineFunction::allocateRegMaskArray () {
626630 unsigned NumRegs = getSubtarget ().getRegisterInfo ()->getNumRegs ();
627631 unsigned Size = MachineOperand::getRegMaskSize (NumRegs);
628632 uint32_t *Mask = Allocator.Allocate <uint32_t >(Size);
629633 memset (Mask, 0 , Size * sizeof (Mask[0 ]));
630- return Mask;
634+ return { Mask, Size} ;
631635}
632636
633637ArrayRef<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