diff options
author | Sanjay Patel <spatel@rotateright.com> | 2022-08-25 15:43:39 -0400 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2022-08-25 16:52:40 -0400 |
commit | 4e44c22c97be99f7c3864fb9fc68b3295835d837 (patch) | |
tree | 15f81c836778b364b8b64402c7c36155ef9c3a25 /llvm/unittests/Analysis/ValueTrackingTest.cpp | |
parent | 681b97e5869d49b1e5163534811f370ba5ac0e40 (diff) | |
download | llvm-4e44c22c97be99f7c3864fb9fc68b3295835d837.zip llvm-4e44c22c97be99f7c3864fb9fc68b3295835d837.tar.gz llvm-4e44c22c97be99f7c3864fb9fc68b3295835d837.tar.bz2 |
[ValueTracking][InstCombine] restrict FP min/max matching to avoid miscompile
This is a long-standing FIXME with a non-FMF test that exposes
the bug as shown in issue #57357.
It's possible that there's still a way to miscompile by
mis-identifying/mis-folding FP min/max patterns, but
this patch only exposes a couple of seemingly minor
regressions while preventing the broken transform.
Diffstat (limited to 'llvm/unittests/Analysis/ValueTrackingTest.cpp')
-rw-r--r-- | llvm/unittests/Analysis/ValueTrackingTest.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/llvm/unittests/Analysis/ValueTrackingTest.cpp b/llvm/unittests/Analysis/ValueTrackingTest.cpp index 902107d..05e6a09 100644 --- a/llvm/unittests/Analysis/ValueTrackingTest.cpp +++ b/llvm/unittests/Analysis/ValueTrackingTest.cpp @@ -202,7 +202,7 @@ TEST_F(MatchSelectPatternTest, FMinMismatchConstantZero1) { " ret float %A\n" "}\n"); // The sign of zero doesn't matter in fcmp. - expectPattern({SPF_FMINNUM, SPNB_RETURNS_NAN, true}); + expectPattern({SPF_UNKNOWN, SPNB_NA, false}); } TEST_F(MatchSelectPatternTest, FMinMismatchConstantZero2) { @@ -213,7 +213,7 @@ TEST_F(MatchSelectPatternTest, FMinMismatchConstantZero2) { " ret float %A\n" "}\n"); // The sign of zero doesn't matter in fcmp. - expectPattern({SPF_FMINNUM, SPNB_RETURNS_NAN, false}); + expectPattern({SPF_UNKNOWN, SPNB_NA, false}); } TEST_F(MatchSelectPatternTest, FMinMismatchConstantZero3) { @@ -224,7 +224,7 @@ TEST_F(MatchSelectPatternTest, FMinMismatchConstantZero3) { " ret float %A\n" "}\n"); // The sign of zero doesn't matter in fcmp. - expectPattern({SPF_FMINNUM, SPNB_RETURNS_NAN, true}); + expectPattern({SPF_UNKNOWN, SPNB_NA, false}); } TEST_F(MatchSelectPatternTest, FMinMismatchConstantZero4) { @@ -235,7 +235,7 @@ TEST_F(MatchSelectPatternTest, FMinMismatchConstantZero4) { " ret float %A\n" "}\n"); // The sign of zero doesn't matter in fcmp. - expectPattern({SPF_FMINNUM, SPNB_RETURNS_NAN, false}); + expectPattern({SPF_UNKNOWN, SPNB_NA, false}); } TEST_F(MatchSelectPatternTest, FMinMismatchConstantZero5) { @@ -246,7 +246,7 @@ TEST_F(MatchSelectPatternTest, FMinMismatchConstantZero5) { " ret float %A\n" "}\n"); // The sign of zero doesn't matter in fcmp. - expectPattern({SPF_FMINNUM, SPNB_RETURNS_OTHER, false}); + expectPattern({SPF_UNKNOWN, SPNB_NA, false}); } TEST_F(MatchSelectPatternTest, FMinMismatchConstantZero6) { @@ -257,7 +257,7 @@ TEST_F(MatchSelectPatternTest, FMinMismatchConstantZero6) { " ret float %A\n" "}\n"); // The sign of zero doesn't matter in fcmp. - expectPattern({SPF_FMINNUM, SPNB_RETURNS_OTHER, true}); + expectPattern({SPF_UNKNOWN, SPNB_NA, false}); } TEST_F(MatchSelectPatternTest, FMinMismatchConstantZero7) { @@ -268,7 +268,7 @@ TEST_F(MatchSelectPatternTest, FMinMismatchConstantZero7) { " ret float %A\n" "}\n"); // The sign of zero doesn't matter in fcmp. - expectPattern({SPF_FMINNUM, SPNB_RETURNS_OTHER, false}); + expectPattern({SPF_UNKNOWN, SPNB_NA, false}); } TEST_F(MatchSelectPatternTest, FMinMismatchConstantZero8) { @@ -279,7 +279,7 @@ TEST_F(MatchSelectPatternTest, FMinMismatchConstantZero8) { " ret float %A\n" "}\n"); // The sign of zero doesn't matter in fcmp. - expectPattern({SPF_FMINNUM, SPNB_RETURNS_OTHER, true}); + expectPattern({SPF_UNKNOWN, SPNB_NA, false}); } TEST_F(MatchSelectPatternTest, FMaxMismatchConstantZero1) { @@ -290,7 +290,7 @@ TEST_F(MatchSelectPatternTest, FMaxMismatchConstantZero1) { " ret float %A\n" "}\n"); // The sign of zero doesn't matter in fcmp. - expectPattern({SPF_FMAXNUM, SPNB_RETURNS_NAN, true}); + expectPattern({SPF_UNKNOWN, SPNB_NA, false}); } TEST_F(MatchSelectPatternTest, FMaxMismatchConstantZero2) { @@ -301,7 +301,7 @@ TEST_F(MatchSelectPatternTest, FMaxMismatchConstantZero2) { " ret float %A\n" "}\n"); // The sign of zero doesn't matter in fcmp. - expectPattern({SPF_FMAXNUM, SPNB_RETURNS_NAN, false}); + expectPattern({SPF_UNKNOWN, SPNB_NA, false}); } TEST_F(MatchSelectPatternTest, FMaxMismatchConstantZero3) { @@ -312,7 +312,7 @@ TEST_F(MatchSelectPatternTest, FMaxMismatchConstantZero3) { " ret float %A\n" "}\n"); // The sign of zero doesn't matter in fcmp. - expectPattern({SPF_FMAXNUM, SPNB_RETURNS_NAN, true}); + expectPattern({SPF_UNKNOWN, SPNB_NA, false}); } TEST_F(MatchSelectPatternTest, FMaxMismatchConstantZero4) { @@ -323,7 +323,7 @@ TEST_F(MatchSelectPatternTest, FMaxMismatchConstantZero4) { " ret float %A\n" "}\n"); // The sign of zero doesn't matter in fcmp. - expectPattern({SPF_FMAXNUM, SPNB_RETURNS_NAN, false}); + expectPattern({SPF_UNKNOWN, SPNB_NA, false}); } TEST_F(MatchSelectPatternTest, FMaxMismatchConstantZero5) { @@ -334,7 +334,7 @@ TEST_F(MatchSelectPatternTest, FMaxMismatchConstantZero5) { " ret float %A\n" "}\n"); // The sign of zero doesn't matter in fcmp. - expectPattern({SPF_FMAXNUM, SPNB_RETURNS_OTHER, false}); + expectPattern({SPF_UNKNOWN, SPNB_NA, false}); } TEST_F(MatchSelectPatternTest, FMaxMismatchConstantZero6) { @@ -345,7 +345,7 @@ TEST_F(MatchSelectPatternTest, FMaxMismatchConstantZero6) { " ret float %A\n" "}\n"); // The sign of zero doesn't matter in fcmp. - expectPattern({SPF_FMAXNUM, SPNB_RETURNS_OTHER, true}); + expectPattern({SPF_UNKNOWN, SPNB_NA, false}); } TEST_F(MatchSelectPatternTest, FMaxMismatchConstantZero7) { @@ -356,7 +356,7 @@ TEST_F(MatchSelectPatternTest, FMaxMismatchConstantZero7) { " ret float %A\n" "}\n"); // The sign of zero doesn't matter in fcmp. - expectPattern({SPF_FMAXNUM, SPNB_RETURNS_OTHER, false}); + expectPattern({SPF_UNKNOWN, SPNB_NA, false}); } TEST_F(MatchSelectPatternTest, FMaxMismatchConstantZero8) { @@ -367,7 +367,7 @@ TEST_F(MatchSelectPatternTest, FMaxMismatchConstantZero8) { " ret float %A\n" "}\n"); // The sign of zero doesn't matter in fcmp. - expectPattern({SPF_FMAXNUM, SPNB_RETURNS_OTHER, true}); + expectPattern({SPF_UNKNOWN, SPNB_NA, false}); } TEST_F(MatchSelectPatternTest, FMinMismatchConstantZeroVecUndef) { |