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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 10 01:49:12 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);
+    }
----------------
nikic wrote:

Do we need to copy other metadata as well, such as `kcfi_type`?

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


More information about the llvm-commits mailing list