[llvm] 6d34374 - [ValueTracking] add tests for smin/smax; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 4 10:46:34 PDT 2020
Author: Sanjay Patel
Date: 2020-04-04T13:44:06-04:00
New Revision: 6d3437404353b3fc4bb53b8b110f7802be1b7227
URL: https://github.com/llvm/llvm-project/commit/6d3437404353b3fc4bb53b8b110f7802be1b7227
DIFF: https://github.com/llvm/llvm-project/commit/6d3437404353b3fc4bb53b8b110f7802be1b7227.diff
LOG: [ValueTracking] add tests for smin/smax; NFC
Added:
Modified:
llvm/unittests/Analysis/ValueTrackingTest.cpp
Removed:
################################################################################
diff --git a/llvm/unittests/Analysis/ValueTrackingTest.cpp b/llvm/unittests/Analysis/ValueTrackingTest.cpp
index 96b41d93d568..7c7a21b21cd1 100644
--- a/llvm/unittests/Analysis/ValueTrackingTest.cpp
+++ b/llvm/unittests/Analysis/ValueTrackingTest.cpp
@@ -462,6 +462,54 @@ TEST_F(MatchSelectPatternTest, DoubleCastBad) {
expectPattern({SPF_UNKNOWN, SPNB_NA, false});
}
+TEST_F(MatchSelectPatternTest, NotNotSMin) {
+ parseAssembly(
+ "define i8 @test(i8 %a, i8 %b) {\n"
+ " %cmp = icmp sgt i8 %a, %b\n"
+ " %an = xor i8 %a, -1\n"
+ " %bn = xor i8 %b, -1\n"
+ " %A = select i1 %cmp, i8 %an, i8 %bn\n"
+ " ret i8 %A\n"
+ "}\n");
+ expectPattern({SPF_UNKNOWN, SPNB_NA, false});
+}
+
+TEST_F(MatchSelectPatternTest, NotNotSMinSwap) {
+ parseAssembly(
+ "define i8 @test(i8 %a, i8 %b) {\n"
+ " %cmp = icmp slt i8 %a, %b\n"
+ " %an = xor i8 %a, -1\n"
+ " %bn = xor i8 %b, -1\n"
+ " %A = select i1 %cmp, i8 %bn, i8 %an\n"
+ " ret i8 %A\n"
+ "}\n");
+ expectPattern({SPF_UNKNOWN, SPNB_NA, false});
+}
+
+TEST_F(MatchSelectPatternTest, NotNotSMax) {
+ parseAssembly(
+ "define i8 @test(i8 %a, i8 %b) {\n"
+ " %cmp = icmp slt i8 %a, %b\n"
+ " %an = xor i8 %a, -1\n"
+ " %bn = xor i8 %b, -1\n"
+ " %A = select i1 %cmp, i8 %an, i8 %bn\n"
+ " ret i8 %A\n"
+ "}\n");
+ expectPattern({SPF_UNKNOWN, SPNB_NA, false});
+}
+
+TEST_F(MatchSelectPatternTest, NotNotSMaxSwap) {
+ parseAssembly(
+ "define i8 @test(i8 %a, i8 %b) {\n"
+ " %cmp = icmp sgt i8 %a, %b\n"
+ " %an = xor i8 %a, -1\n"
+ " %bn = xor i8 %b, -1\n"
+ " %A = select i1 %cmp, i8 %bn, i8 %an\n"
+ " ret i8 %A\n"
+ "}\n");
+ expectPattern({SPF_UNKNOWN, SPNB_NA, false});
+}
+
TEST(ValueTracking, GuaranteedToTransferExecutionToSuccessor) {
StringRef Assembly =
"declare void @nounwind_readonly(i32*) nounwind readonly "
More information about the llvm-commits
mailing list