mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-18 07:06:38 +00:00
llvm-reduce: Fix losing metadata when removing arguments (#133409)
This commit is contained in:
parent
688df34634
commit
115a77df9d
@ -16,11 +16,14 @@ declare float @math_callee_decl(float %a, float %b)
|
||||
; INTERESTING: call
|
||||
; INTERESTING: call
|
||||
|
||||
; RESULT: %call0 = call nnan nsz float @math_callee()
|
||||
; RESULT: %call0 = call nnan nsz float @math_callee(), !fpmath !0
|
||||
; RESULT: %call1 = call ninf float @math_callee_decl()
|
||||
define float @math_caller(float %x) {
|
||||
%call0 = call nnan nsz float @math_callee(float %x, float 2.0)
|
||||
%call0 = call nnan nsz float @math_callee(float %x, float 2.0), !fpmath !0
|
||||
%call1 = call ninf float @math_callee_decl(float %x, float 2.0)
|
||||
%result = fadd float %call0, %call1
|
||||
ret float %result
|
||||
}
|
||||
|
||||
; RESULT: !0 = !{float 2.000000e+00}
|
||||
!0 = !{float 2.0}
|
||||
|
@ -61,7 +61,7 @@ static void replaceFunctionCalls(Function &OldF, Function &NewF,
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: Losing bundles and metadata
|
||||
// FIXME: Losing bundles
|
||||
CallInst *NewCI = CallInst::Create(&NewF, Args);
|
||||
NewCI->setCallingConv(NewF.getCallingConv());
|
||||
|
||||
@ -78,6 +78,8 @@ static void replaceFunctionCalls(Function &OldF, Function &NewF,
|
||||
if (auto *FPOp = dyn_cast<FPMathOperator>(NewCI))
|
||||
cast<Instruction>(FPOp)->setFastMathFlags(CI->getFastMathFlags());
|
||||
|
||||
NewCI->copyMetadata(*CI);
|
||||
|
||||
if (!CI->use_empty())
|
||||
CI->replaceAllUsesWith(NewCI);
|
||||
ReplaceInstWithInst(CI, NewCI);
|
||||
|
Loading…
x
Reference in New Issue
Block a user