Skip to content

Commit 410a89c

Browse files
Pass nullptr to get costs of the call to fmod/fmodff
1 parent a2d657f commit 410a89c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2973,11 +2973,10 @@ InstructionCost AArch64TTIImpl::getArithmeticInstrCost(
29732973
return BaseT::getArithmeticInstrCost(Opcode, Ty, CostKind, Op1Info,
29742974
Op2Info);
29752975
case ISD::FREM:
2976-
if (!Ty->isVectorTy()) {
2977-
Function *F =
2978-
CxtI == nullptr ? nullptr : CxtI->getModule()->getFunction("fmod");
2979-
return getCallInstrCost(F, Ty, {Ty, Ty}, CostKind);
2980-
}
2976+
// Pass nullptr as fmod/fmodf calls are emitted by the backend even when
2977+
// those functions are not delcared in the module.
2978+
if (!Ty->isVectorTy())
2979+
return getCallInstrCost(/*Function*/ nullptr, Ty, {Ty, Ty}, CostKind);
29812980
return BaseT::getArithmeticInstrCost(Opcode, Ty, CostKind, Op1Info,
29822981
Op2Info);
29832982
}

0 commit comments

Comments
 (0)