[llvm] [MergeFuncs/CFI] Ensure all type metadata is propogated for CFI (PR #88218)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 9 23:07:09 PDT 2024
================
@@ -712,10 +712,13 @@ static bool canCreateThunkFor(Function *F) {
return true;
}
-/// Copy metadata from one function to another.
-static void copyMetadataIfPresent(Function *From, Function *To, StringRef Key) {
- if (MDNode *MD = From->getMetadata(Key)) {
- To->setMetadata(Key, MD);
+/// Copy all metadata of a specific kind from one function to another.
+static void copyMetadataIfPresent(Function *From, Function *To,
+ StringRef Kind) {
+ SmallVector<MDNode *, 4> MDs;
+ From->getMetadata(Kind, MDs);
+ for (MDNode *MD : MDs) {
----------------
nikic wrote:
No braces for single-line if.
https://github.com/llvm/llvm-project/pull/88218
More information about the llvm-commits
mailing list