AMDGPU/GlobalISel Check for NoNaNsFPMath in isKnownNeverSNaN
authorPetar Avramovic <Petar.Avramovic@amd.com>
Mon, 14 Sep 2020 10:03:36 +0000 (12:03 +0200)
committerPetar Avramovic <Petar.Avramovic@amd.com>
Mon, 14 Sep 2020 10:11:00 +0000 (12:11 +0200)
commit6e2a86ed5abfdb75ba9c08ea94ed8dbd41e75c9e
tree8b50e463da6af7e8a40250039e97db7ec3ece9c0
parent416346d1ca503262983c954ddc861ff4f91347a3
AMDGPU/GlobalISel Check for NoNaNsFPMath in isKnownNeverSNaN

Check for NoNaNsFPMath function attribute in isKnownNeverSNaN.
Function attributes are in held in 'TargetMachine.Options'.
Among other things, this allows selection of some patterns imported
in D87351 since G_FCANONICALIZE is not generated when isKnownNeverSNaN
returns true in lowerFMinNumMaxNum.

However we notice some incorrect results since function attributes are
not correctly written in TargetMachine.Options when next function is
processed. Take a look at @v_test_no_global_nnans_med3_f32_pat0_srcmod0,
it has "no-nans-fp-math"="false" but TargetMachine.Options still has it
set to true since first function in test file had this attribute set to
true. This will be fixed in D87511.

Differential Revision: https://reviews.llvm.org/D87456
llvm/lib/CodeGen/GlobalISel/Utils.cpp
llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
llvm/test/CodeGen/AMDGPU/GlobalISel/fmed3.ll [new file with mode: 0644]