[llvm] [CFI/MergeFunctions] Modify MergeFunctions to propagate type information (PR #68628)

Oskar Wirga via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 10 12:38:57 PDT 2023


================
@@ -740,6 +740,10 @@ void MergeFunctions::writeThunk(Function *F, Function *G) {
   } else {
     NewG->copyAttributesFrom(G);
     NewG->takeName(G);
+    // Ensure CFI type metadata is propagated to the new function.
+    if (MDNode *TypeMD = G->getMetadata("type")) {
+      NewG->setMetadata("type", TypeMD);
+    }
----------------
oskarwirga wrote:

I have created a helper function in case others identify additional metadata that should be copied over. 

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


More information about the llvm-commits mailing list