[llvm] [LICM] Fix dropped metadata (PR #95221)

Tim Gymnich via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 12 03:40:03 PDT 2024


https://github.com/tgymnich created https://github.com/llvm/llvm-project/pull/95221

Fixes  #91919

LICM drops metadata for call instructions when cloning instructions.
This patch just adds the missing `copyMetadata`.

>From 7ed902e671b3b0a073984d3347e1aff9548cb589 Mon Sep 17 00:00:00 2001
From: Tim Gymnich <tgymnich at icloud.com>
Date: Tue, 11 Jun 2024 23:38:44 +0200
Subject: [PATCH] Fix dropped metadata in LICM

---
 llvm/lib/Transforms/Scalar/LICM.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index 5eccf7b4adb65..75883e0da214d 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -1453,6 +1453,7 @@ static Instruction *cloneInstructionInExitBlock(
     }
 
     New = CallInst::Create(CI, OpBundles);
+    New->copyMetadata(*CI);
   } else {
     New = I.clone();
   }



More information about the llvm-commits mailing list