[llvm] [ValueTracking] Handle intrinsics in `computeConstantRange` (PR #100870)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 27 06:44:26 PDT 2024


================
@@ -230,3 +230,72 @@ define i1 @srem_negC_fail1(i8 %x) {
   %r = icmp sge i8 %val, -33
   ret i1 %r
 }
+
+define i1 @intrinsic_test1(i64 %x, i32 %y, i64 %z) {
+; CHECK-LABEL: @intrinsic_test1(
+; CHECK-NEXT:    ret i1 false
+;
+  %sh_prom = zext nneg i32 %y to i64
+  %shl = shl nuw i64 1, %sh_prom
+  %cmp1 = icmp eq i64 %z, 0
+  %umin1 = call i64 @llvm.umin.i64(i64 %shl, i64 %z)
+  %sel = select i1 %cmp1, i64 1, i64 %umin1
+  %umin2 = call i64 @llvm.umin.i64(i64 %x, i64 %sel)
+  %cmp = icmp ugt i64 %umin2, -71777214294589697
+  ret i1 %cmp
+}
----------------
nikic wrote:

Won't this case already be handled by CVP with the shl nuw support from https://github.com/llvm/llvm-project/pull/100594?

https://github.com/llvm/llvm-project/pull/100870


More information about the llvm-commits mailing list