[llvm] 2ff82c2 - [ValueTracking] Add tests for improving `isKnownNonZero` of `smax`; NFC
Noah Goldstein via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 10 08:41:11 PDT 2024
Author: Noah Goldstein
Date: 2024-04-10T10:40:49-05:00
New Revision: 2ff82c2c6490a1478e4311f60f1ce80af0957403
URL: https://github.com/llvm/llvm-project/commit/2ff82c2c6490a1478e4311f60f1ce80af0957403
DIFF: https://github.com/llvm/llvm-project/commit/2ff82c2c6490a1478e4311f60f1ce80af0957403.diff
LOG: [ValueTracking] Add tests for improving `isKnownNonZero` of `smax`; NFC
Added:
Modified:
llvm/test/Transforms/InstSimplify/known-non-zero.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstSimplify/known-non-zero.ll b/llvm/test/Transforms/InstSimplify/known-non-zero.ll
index b647f11af4461d..6ebc4e0f31a9cf 100644
--- a/llvm/test/Transforms/InstSimplify/known-non-zero.ll
+++ b/llvm/test/Transforms/InstSimplify/known-non-zero.ll
@@ -166,3 +166,18 @@ A:
B:
ret i1 0
}
+
+define i1 @smax_non_zero(i8 %xx, i8 %y) {
+; CHECK-LABEL: @smax_non_zero(
+; CHECK-NEXT: [[X0:%.*]] = and i8 [[XX:%.*]], 63
+; CHECK-NEXT: [[X:%.*]] = add i8 [[X0]], 1
+; CHECK-NEXT: [[V:%.*]] = call i8 @llvm.smax.i8(i8 [[X]], i8 [[Y:%.*]])
+; CHECK-NEXT: [[R:%.*]] = icmp eq i8 [[V]], 0
+; CHECK-NEXT: ret i1 [[R]]
+;
+ %x0 = and i8 %xx, 63
+ %x = add i8 %x0, 1
+ %v = call i8 @llvm.smax.i8(i8 %x, i8 %y)
+ %r = icmp eq i8 %v, 0
+ ret i1 %r
+}
More information about the llvm-commits
mailing list