Skip to content

Commit 2bd8ae1

Browse files
committed
llvm-reduce: Fix using call metadata in operands-to-args
1 parent f7605ba commit 2bd8ae1

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

llvm/test/tools/llvm-reduce/operands-to-args-preserve-fmf.ll

+5-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ define float @callee(float %a) {
1212
; INTERESTING: load float
1313

1414
; REDUCED-LABEL: define float @caller(ptr %ptr, float %val, float %callee.ret1) {
15-
; REDUCED: %callee.ret12 = call nnan nsz float @callee(float %val, float 0.000000e+00)
15+
; REDUCED: %callee.ret12 = call nnan nsz float @callee(float %val, float 0.000000e+00), !fpmath !0
1616
define float @caller(ptr %ptr) {
1717
%val = load float, ptr %ptr
18-
%callee.ret = call nnan nsz float @callee(float %val)
18+
%callee.ret = call nnan nsz float @callee(float %val), !fpmath !0
1919
ret float %callee.ret
2020
}
21+
22+
; REDUCED: !0 = !{float 2.000000e+00}
23+
!0 = !{float 2.0}

llvm/tools/llvm-reduce/deltas/ReduceOperandsToArgs.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ static void replaceFunctionCalls(Function *OldF, Function *NewF) {
111111
if (auto *FPOp = dyn_cast<FPMathOperator>(NewCI))
112112
NewCI->setFastMathFlags(CI->getFastMathFlags());
113113

114+
NewCI->copyMetadata(*CI);
115+
114116
// Do the replacement for this use.
115117
if (!CI->use_empty())
116118
CI->replaceAllUsesWith(NewCI);

0 commit comments

Comments
 (0)