[llvm] [llvm] Use OwningArrayRef in NodeMetadata (NFC) (PR #137539)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 27 13:50:06 PDT 2025


================
@@ -183,18 +184,14 @@ class NodeMetadata {
   NodeMetadata() = default;
 
   NodeMetadata(const NodeMetadata &Other)
-      : RS(Other.RS), NumOpts(Other.NumOpts), DeniedOpts(Other.DeniedOpts),
-        OptUnsafeEdges(new unsigned[NumOpts]), VReg(Other.VReg),
-        AllowedRegs(Other.AllowedRegs)
+      : RS(Other.RS), DeniedOpts(Other.DeniedOpts),
+        OptUnsafeEdges(ArrayRef<unsigned>(Other.OptUnsafeEdges)),
----------------
kazutakahirata wrote:

Yes.  Without the explicit cast, I would get:

```
llvm/include/llvm/CodeGen/RegAllocPBQP.h:188:9: error: call to implicitly-deleted copy constructor of 'OwningArrayRef<unsigned int>'
        OptUnsafeEdges(Other.OptUnsafeEdges),
        ^              ~~~~~~~~~~~~~~~~~~~~
```


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


More information about the llvm-commits mailing list