[llvm] 9313509 - [CVP] Add test for !range on intrinsic (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 2 07:46:30 PDT 2021
Author: Nikita Popov
Date: 2021-04-02T16:45:30+02:00
New Revision: 93135091b1f9b7f0ce143068f102f0970c9d63c7
URL: https://github.com/llvm/llvm-project/commit/93135091b1f9b7f0ce143068f102f0970c9d63c7
DIFF: https://github.com/llvm/llvm-project/commit/93135091b1f9b7f0ce143068f102f0970c9d63c7.diff
LOG: [CVP] Add test for !range on intrinsic (NFC)
Added:
Modified:
llvm/test/Transforms/CorrelatedValuePropagation/range.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/CorrelatedValuePropagation/range.ll b/llvm/test/Transforms/CorrelatedValuePropagation/range.ll
index 5bc90cb2dd139..356c4b8904201 100644
--- a/llvm/test/Transforms/CorrelatedValuePropagation/range.ll
+++ b/llvm/test/Transforms/CorrelatedValuePropagation/range.ll
@@ -240,7 +240,7 @@ sw.default:
define i1 @test8(i64* %p) {
; CHECK-LABEL: @test8(
-; CHECK-NEXT: [[A:%.*]] = load i64, i64* [[P:%.*]], align 4, [[RNG0:!range !.*]]
+; CHECK-NEXT: [[A:%.*]] = load i64, i64* [[P:%.*]], align 4, !range [[RNG0:![0-9]+]]
; CHECK-NEXT: ret i1 false
;
%a = load i64, i64* %p, !range !{i64 4, i64 255}
@@ -250,7 +250,7 @@ define i1 @test8(i64* %p) {
define i1 @test9(i64* %p) {
; CHECK-LABEL: @test9(
-; CHECK-NEXT: [[A:%.*]] = load i64, i64* [[P:%.*]], align 4, [[RNG1:!range !.*]]
+; CHECK-NEXT: [[A:%.*]] = load i64, i64* [[P:%.*]], align 4, !range [[RNG1:![0-9]+]]
; CHECK-NEXT: ret i1 true
;
%a = load i64, i64* %p, !range !{i64 0, i64 1}
@@ -260,7 +260,7 @@ define i1 @test9(i64* %p) {
define i1 @test10(i64* %p) {
; CHECK-LABEL: @test10(
-; CHECK-NEXT: [[A:%.*]] = load i64, i64* [[P:%.*]], align 4, [[RNG2:!range !.*]]
+; CHECK-NEXT: [[A:%.*]] = load i64, i64* [[P:%.*]], align 4, !range [[RNG2:![0-9]+]]
; CHECK-NEXT: ret i1 false
;
%a = load i64, i64* %p, !range !{i64 4, i64 8, i64 15, i64 20}
@@ -272,7 +272,7 @@ define i1 @test10(i64* %p) {
define i1 @test11() {
; CHECK-LABEL: @test11(
-; CHECK-NEXT: [[POSITIVE:%.*]] = load i32, i32* @g, align 4, [[RNG3:!range !.*]]
+; CHECK-NEXT: [[POSITIVE:%.*]] = load i32, i32* @g, align 4, !range [[RNG3:![0-9]+]]
; CHECK-NEXT: [[ADD:%.*]] = add nuw nsw i32 [[POSITIVE]], 1
; CHECK-NEXT: br label [[NEXT:%.*]]
; CHECK: next:
@@ -653,7 +653,7 @@ else:
@limit = external global i32
define i1 @test15(i32 %a) {
; CHECK-LABEL: @test15(
-; CHECK-NEXT: [[LIMIT:%.*]] = load i32, i32* @limit, align 4, [[RNG4:!range !.*]]
+; CHECK-NEXT: [[LIMIT:%.*]] = load i32, i32* @limit, align 4, !range [[RNG4:![0-9]+]]
; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[A:%.*]], [[LIMIT]]
; CHECK-NEXT: br i1 [[CMP]], label [[THEN:%.*]], label [[ELSE:%.*]]
; CHECK: then:
@@ -934,4 +934,18 @@ entry:
ret i1 %res
}
+define i1 @intrinsic_range(i16 %x) {
+; CHECK-LABEL: @intrinsic_range(
+; CHECK-NEXT: [[CTLZ:%.*]] = call i16 @llvm.ctlz.i16(i16 [[X:%.*]], i1 false), !range [[RNG5:![0-9]+]]
+; CHECK-NEXT: [[TRUNC:%.*]] = trunc i16 [[CTLZ]] to i8
+; CHECK-NEXT: [[RES:%.*]] = icmp ult i8 [[TRUNC]], 8
+; CHECK-NEXT: ret i1 [[RES]]
+;
+ %ctlz = call i16 @llvm.ctlz.i16(i16 %x, i1 false), !range !{i16 0, i16 8}
+ %trunc = trunc i16 %ctlz to i8
+ %res = icmp ult i8 %trunc, 8
+ ret i1 %res
+}
+
+declare i16 @llvm.ctlz.i16(i16, i1)
declare void @llvm.assume(i1)
More information about the llvm-commits
mailing list