From 49d70380a6a95e4039f6b5e5ccce09671d5b4796 Mon Sep 17 00:00:00 2001 From: Richard-Qin-X Date: Sun, 2 Aug 2026 02:56:39 +0800 Subject: [CodeGen] Add machine metadata graphs Model ordered function-local metadata tuples with explicit embedded-IR and MachineFunction reference scopes. Preserve slot zero, distinct nodes, forward references, and cyclic graphs while verifying function-local closure and cloning the graph deterministically. --- backend/lib/CodeGen/MachineFunctionCloner.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'backend/lib/CodeGen/MachineFunctionCloner.cpp') diff --git a/backend/lib/CodeGen/MachineFunctionCloner.cpp b/backend/lib/CodeGen/MachineFunctionCloner.cpp index 2f99341..e12e33e 100644 --- a/backend/lib/CodeGen/MachineFunctionCloner.cpp +++ b/backend/lib/CodeGen/MachineFunctionCloner.cpp @@ -626,6 +626,10 @@ Expected cloneMachineFunction(const MachineFunction if (!Records) return std::unexpected(Records.error()); Result.ClonedFunction->records() = std::move(*Records); + auto Metadata = Source.metadata().clone(); + if (!Metadata) + return std::unexpected(Metadata.error()); + Result.ClonedFunction->metadata() = std::move(*Metadata); Result.ClonedFunction->properties() = Source.properties(); Result.ClonedFunction->attributes() = Source.attributes(); auto DestinationVerification = MachineVerifier::verify(*Result.ClonedFunction, Target); -- cgit v1.2.3