aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2025-03-29 16:20:49 +0700
committerGitHub <noreply@github.com>2025-03-29 16:20:49 +0700
commitd852cc5311e22d845b3d626c80a310570628fa2c (patch)
treec7827de7dc5852cc450f9111aeccc4c74df808eb
parentd3d4a242de047f41589b4e2a27ecbcc3273d4cbf (diff)
downloadllvm-d852cc5311e22d845b3d626c80a310570628fa2c.zip
llvm-d852cc5311e22d845b3d626c80a310570628fa2c.tar.gz
llvm-d852cc5311e22d845b3d626c80a310570628fa2c.tar.bz2
llvm-reduce: Fix losing call metadata in operands-to-args (#133422)
-rw-r--r--llvm/test/tools/llvm-reduce/operands-to-args-preserve-fmf.ll7
-rw-r--r--llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.cpp2
2 files changed, 7 insertions, 2 deletions
diff --git a/llvm/test/tools/llvm-reduce/operands-to-args-preserve-fmf.ll b/llvm/test/tools/llvm-reduce/operands-to-args-preserve-fmf.ll
index b4b19ca2..fc31a08 100644
--- a/llvm/test/tools/llvm-reduce/operands-to-args-preserve-fmf.ll
+++ b/llvm/test/tools/llvm-reduce/operands-to-args-preserve-fmf.ll
@@ -12,9 +12,12 @@ define float @callee(float %a) {
; INTERESTING: load float
; REDUCED-LABEL: define float @caller(ptr %ptr, float %val, float %callee.ret1) {
-; REDUCED: %callee.ret12 = call nnan nsz float @callee(float %val, float 0.000000e+00)
+; REDUCED: %callee.ret12 = call nnan nsz float @callee(float %val, float 0.000000e+00), !fpmath !0
define float @caller(ptr %ptr) {
%val = load float, ptr %ptr
- %callee.ret = call nnan nsz float @callee(float %val)
+ %callee.ret = call nnan nsz float @callee(float %val), !fpmath !0
ret float %callee.ret
}
+
+; REDUCED: !0 = !{float 2.000000e+00}
+!0 = !{float 2.0}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.cpp b/llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.cpp
index e1c1c9c..6b1958e 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.cpp
@@ -111,6 +111,8 @@ static void replaceFunctionCalls(Function *OldF, Function *NewF) {
if (auto *FPOp = dyn_cast<FPMathOperator>(NewCI))
NewCI->setFastMathFlags(CI->getFastMathFlags());
+ NewCI->copyMetadata(*CI);
+
// Do the replacement for this use.
if (!CI->use_empty())
CI->replaceAllUsesWith(NewCI);