diff options
author | Yingwei Zheng <dtcxzyw2333@gmail.com> | 2025-06-09 15:46:09 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-09 15:46:09 +0800 |
commit | 2f15637e04f51e3ef435c0c0d39aab0e8b933023 (patch) | |
tree | ad32081a9b8a8970938c7953a09ce4443ea53565 /llvm/unittests/Analysis | |
parent | 5d3899d293e902124c3602b466031b6b799fb123 (diff) | |
download | llvm-2f15637e04f51e3ef435c0c0d39aab0e8b933023.zip llvm-2f15637e04f51e3ef435c0c0d39aab0e8b933023.tar.gz llvm-2f15637e04f51e3ef435c0c0d39aab0e8b933023.tar.bz2 |
[ValueTracking] Update `Ordered` when both operands are non-NaN. (#143349)
When the original predicate is ordered and both operands are non-NaN,
`Ordered` should be set to true. This variable still matters even if
both operands are non-NaN because FMF only applies to select, not fcmp.
Closes https://github.com/llvm/llvm-project/issues/143123.
Diffstat (limited to 'llvm/unittests/Analysis')
-rw-r--r-- | llvm/unittests/Analysis/ValueTrackingTest.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/unittests/Analysis/ValueTrackingTest.cpp b/llvm/unittests/Analysis/ValueTrackingTest.cpp index e23005b..6031898 100644 --- a/llvm/unittests/Analysis/ValueTrackingTest.cpp +++ b/llvm/unittests/Analysis/ValueTrackingTest.cpp @@ -187,6 +187,15 @@ TEST_F(MatchSelectPatternTest, FastFMin) { " %A = select i1 %1, float %a, float 5.0\n" " ret float %A\n" "}\n"); + expectPattern({SPF_FMINNUM, SPNB_RETURNS_ANY, true}); +} + +TEST_F(MatchSelectPatternTest, FastFMinUnordered) { + parseAssembly("define float @test(float %a) {\n" + " %1 = fcmp nnan ult float %a, 5.0\n" + " %A = select i1 %1, float %a, float 5.0\n" + " ret float %A\n" + "}\n"); expectPattern({SPF_FMINNUM, SPNB_RETURNS_ANY, false}); } |