[llvm] Copy missing metadata to new inst created from existing inst (PR #84357)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 7 10:27:09 PST 2024
https://github.com/EnidXiong created https://github.com/llvm/llvm-project/pull/84357
Previously in replaceSignedInst of SCCPSolver.cpp, the new usigned instructions created from the signed instructions are missing debug messages as the metadata are not being propagated over.
Added a line to copy the metadata of the old inst to the new one.
>From 3dd6eca2028471af7abea1fbad1a40440e8fc8b5 Mon Sep 17 00:00:00 2001
From: "Xiong, Yige" <yige.xiong at intel.com>
Date: Thu, 7 Mar 2024 10:18:51 -0800
Subject: [PATCH] copy missing debug loc to new inst created from existing inst
---
llvm/lib/Transforms/Utils/SCCPSolver.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/llvm/lib/Transforms/Utils/SCCPSolver.cpp b/llvm/lib/Transforms/Utils/SCCPSolver.cpp
index a185e8cd371c60..233c097f591805 100644
--- a/llvm/lib/Transforms/Utils/SCCPSolver.cpp
+++ b/llvm/lib/Transforms/Utils/SCCPSolver.cpp
@@ -210,6 +210,7 @@ static bool replaceSignedInst(SCCPSolver &Solver,
// Wire up the new instruction and update state.
assert(NewInst && "Expected replacement instruction");
+ NewInst->copyMetadata(Inst);
NewInst->takeName(&Inst);
InsertedValues.insert(NewInst);
Inst.replaceAllUsesWith(NewInst);
More information about the llvm-commits
mailing list