[AMDGPU] Remove NoNaNsFPMath uses - #180469
Merged
Merged
Conversation
paperchalice
force-pushed
the
rm-amdgpu-nnan
branch
from
February 9, 2026 05:45
05adb08 to
d36d9ce
Compare
paperchalice
force-pushed
the
rm-amdgpu-nnan
branch
from
February 9, 2026 05:51
d36d9ce to
5e89ede
Compare
paperchalice
marked this pull request as ready for review
February 9, 2026 06:25
Member
|
@llvm/pr-subscribers-backend-amdgpu Author: None (paperchalice) ChangesShould use Full diff: https://github.com/llvm/llvm-project/pull/180469.diff 2 Files Affected:
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp b/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
index 466cc6a5156d4..da21033388532 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
@@ -2776,7 +2776,6 @@ SDValue AMDGPUTargetLowering::LowerFLOGCommon(SDValue Op,
const bool IsLog10 = Op.getOpcode() == ISD::FLOG10;
assert(IsLog10 || Op.getOpcode() == ISD::FLOG);
- const auto &Options = getTargetMachine().Options;
if (VT == MVT::f16 || Flags.hasApproximateFuncs()) {
if (VT == MVT::f16 && !isTypeLegal(MVT::f16)) {
@@ -2845,8 +2844,7 @@ SDValue AMDGPUTargetLowering::LowerFLOGCommon(SDValue Op,
R = getMad(DAG, DL, VT, YH, CH, Mad1);
}
- const bool IsFiniteOnly =
- (Flags.hasNoNaNs() || Options.NoNaNsFPMath) && Flags.hasNoInfs();
+ const bool IsFiniteOnly = Flags.hasNoNaNs() && Flags.hasNoInfs();
// TODO: Check if known finite from source value.
if (!IsFiniteOnly) {
diff --git a/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp b/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
index 6d4e4e64280c1..ab1046691ae1d 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
@@ -3554,14 +3554,10 @@ bool AMDGPULegalizerInfo::legalizeFlogCommon(MachineInstr &MI,
Register X = MI.getOperand(1).getReg();
unsigned Flags = MI.getFlags();
const LLT Ty = MRI.getType(X);
- MachineFunction &MF = B.getMF();
const LLT F32 = LLT::scalar(32);
const LLT F16 = LLT::scalar(16);
- const AMDGPUTargetMachine &TM =
- static_cast<const AMDGPUTargetMachine &>(MF.getTarget());
-
if (Ty == F16 || MI.getFlag(MachineInstr::FmAfn)) {
if (Ty == F16 && !ST.has16BitInsts()) {
Register LogVal = MRI.createGenericVirtualRegister(F32);
@@ -3630,8 +3626,7 @@ bool AMDGPULegalizerInfo::legalizeFlogCommon(MachineInstr &MI,
}
const bool IsFiniteOnly =
- (MI.getFlag(MachineInstr::FmNoNans) || TM.Options.NoNaNsFPMath) &&
- MI.getFlag(MachineInstr::FmNoInfs);
+ MI.getFlag(MachineInstr::FmNoNans) && MI.getFlag(MachineInstr::FmNoInfs);
if (!IsFiniteOnly) {
// Expand isfinite(x) => fabs(x) < inf
|
arsenm
approved these changes
Feb 9, 2026
rishabhmadan19
pushed a commit
to rishabhmadan19/llvm-project
that referenced
this pull request
Feb 9, 2026
Should use `nnan` flag only.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Should use
nnanflag only.