[llvm] b5bccde - [InstSimplify] add tests for max intrinsic with constant expression; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 26 13:09:53 PDT 2022
Author: Sanjay Patel
Date: 2022-09-26T16:01:09-04:00
New Revision: b5bccded2c3f293510b3bfe43f82af8b5ba5fae9
URL: https://github.com/llvm/llvm-project/commit/b5bccded2c3f293510b3bfe43f82af8b5ba5fae9
DIFF: https://github.com/llvm/llvm-project/commit/b5bccded2c3f293510b3bfe43f82af8b5ba5fae9.diff
LOG: [InstSimplify] add tests for max intrinsic with constant expression; NFC
This shows the root problem that leads to the crash in issue #57986.
Added:
Modified:
llvm/test/Transforms/InstSimplify/maxmin_intrinsics.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstSimplify/maxmin_intrinsics.ll b/llvm/test/Transforms/InstSimplify/maxmin_intrinsics.ll
index 32ef90a0aec12..d6326baf4b116 100644
--- a/llvm/test/Transforms/InstSimplify/maxmin_intrinsics.ll
+++ b/llvm/test/Transforms/InstSimplify/maxmin_intrinsics.ll
@@ -15,6 +15,25 @@ declare i8 @llvm.umin.i8(i8, i8)
declare <2 x i8> @llvm.umin.v2i8(<2 x i8>, <2 x i8>)
declare void @llvm.assume(i1)
+ at g = external dso_local global [9 x i32], align 4
+
+define i8 @constexpr_maxvalue() {
+; CHECK-LABEL: @constexpr_maxvalue(
+; CHECK-NEXT: ret i8 ptrtoint (ptr @g to i8)
+;
+ %umin = call i8 @llvm.umin.i8(i8 255, i8 ptrtoint (ptr @g to i8))
+ ret i8 %umin
+}
+
+define i8 @constexpr_maxvalue_commute() {
+; CHECK-LABEL: @constexpr_maxvalue_commute(
+; CHECK-NEXT: [[UMIN:%.*]] = call i8 @llvm.umin.i8(i8 ptrtoint (ptr @g to i8), i8 -1)
+; CHECK-NEXT: ret i8 [[UMIN]]
+;
+ %umin = call i8 @llvm.umin.i8(i8 ptrtoint (ptr @g to i8), i8 255)
+ ret i8 %umin
+}
+
define i81 @smax_sameval(i81 %x) {
; CHECK-LABEL: @smax_sameval(
; CHECK-NEXT: ret i81 [[X:%.*]]
More information about the llvm-commits
mailing list