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

Kyungwoo Lee via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 1 10:51:37 PST 2025


================
@@ -1119,8 +1119,10 @@ class LLVM_ABI MachineFunction {
     OperandRecycler.deallocate(Cap, Array);
   }
 
-  /// Allocate and initialize a register mask with @p NumRegister bits.
-  uint32_t *allocateRegMask();
+  /// Allocate and initialize a register mask with all elements set to
+  /// \p InitValue and size reported via \p OutSize if nonnull.
+  uint32_t *allocateRegMask(uint32_t InitValue = 0,
+                            unsigned *OutSize = nullptr);
----------------
kyulee-com wrote:

Can we create another API like the one below and use it to redefine this for backward compatibility?
```
MutableArrayRef<uint32_t> allocateRegMaskArray(uint8_t InitValue = 0);
```

Additionally, looking at the usage of `allocateRegMask()`, there are many cases where it is used for cloning a RegMask. I think creating another API, as shown below, could utilize the above `allocateRegMaskArray()` to simplify the existing code. However, this might be better for a separate PR.
```
uint32_t *cloneRegMask(const uint32_t *RegMask);
```


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


More information about the llvm-commits mailing list