Skip to content

Commit 4f3b41f

Browse files
Pass nullptr to get costs of the call to fmod/fmodff
1 parent 2d9f7aa commit 4f3b41f

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
@@ -2941,11 +2941,10 @@ InstructionCost AArch64TTIImpl::getArithmeticInstrCost(
29412941
return BaseT::getArithmeticInstrCost(Opcode, Ty, CostKind, Op1Info,
29422942
Op2Info);
29432943
case ISD::FREM:
2944-
if (!Ty->isVectorTy()) {
2945-
Function *F =
2946-
CxtI == nullptr ? nullptr : CxtI->getModule()->getFunction("fmod");
2947-
return getCallInstrCost(F, Ty, {Ty, Ty}, CostKind);
2948-
}
2944+
// Pass nullptr as fmod/fmodf calls are emitted by the backend even when
2945+
// those functions are not delcared in the module.
2946+
if (!Ty->isVectorTy())
2947+
return getCallInstrCost(/*Function*/ nullptr, Ty, {Ty, Ty}, CostKind);
29492948
return BaseT::getArithmeticInstrCost(Opcode, Ty, CostKind, Op1Info,
29502949
Op2Info);
29512950
}

0 commit comments

Comments
 (0)