[llvm] a701be8 - [SCEV] [NFC] add more test cases for range of addrecexpr with nsw flag
Zheng Chen via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 10 19:44:57 PST 2020
Author: Zheng Chen
Date: 2020-01-10T22:44:47-05:00
New Revision: a701be8f036accef9a3dab62fa4baa70ea330a80
URL: https://github.com/llvm/llvm-project/commit/a701be8f036accef9a3dab62fa4baa70ea330a80
DIFF: https://github.com/llvm/llvm-project/commit/a701be8f036accef9a3dab62fa4baa70ea330a80.diff
LOG: [SCEV] [NFC] add more test cases for range of addrecexpr with nsw flag
Added:
Modified:
llvm/test/Analysis/ScalarEvolution/range_nw_flag.ll
Removed:
################################################################################
diff --git a/llvm/test/Analysis/ScalarEvolution/range_nw_flag.ll b/llvm/test/Analysis/ScalarEvolution/range_nw_flag.ll
index 4a520056d765..336a84472410 100644
--- a/llvm/test/Analysis/ScalarEvolution/range_nw_flag.ll
+++ b/llvm/test/Analysis/ScalarEvolution/range_nw_flag.ll
@@ -39,12 +39,12 @@ exit:
ret void
}
-; CHECK-LABEL: @test-addrec-nsw
+; CHECK-LABEL: @test-addrec-nsw-start-neg-strip-neg
; CHECK: --> {(-1 + (-10 smin %offset))<nsw>,+,-1}<nsw><%loop> U: [-2147483648,1) S: [-2147483648,1)
-define void @test-addrec-nsw(float* %input, i32 %offset, i32 %numIterations) {
+define void @test-addrec-nsw-start-neg-strip-neg(float* %input, i32 %offset, i32 %numIterations) {
entry:
- %cmp = icmp slt i32 %offset, -10
- %max = select i1 %cmp, i32 %offset, i32 -10
+ %cmp = icmp slt i32 %offset, -10
+ %max = select i1 %cmp, i32 %offset, i32 -10
br label %loop
loop:
%i = phi i32 [ %nexti, %loop ], [ 0, %entry ]
@@ -58,3 +58,64 @@ loop:
exit:
ret void
}
+
+; CHECK-LABEL: @test-addrec-nsw-start-pos-strip-neg
+; CHECK: --> {(-1 + (10 smin %offset))<nsw>,+,-1}<nsw><%loop> U: full-set S: full-set
+define void @test-addrec-nsw-start-pos-strip-neg(float* %input, i32 %offset, i32 %numIterations) {
+entry:
+ %cmp = icmp slt i32 %offset, 10
+ %max = select i1 %cmp, i32 %offset, i32 10
+ br label %loop
+loop:
+ %i = phi i32 [ %nexti, %loop ], [ 0, %entry ]
+ %nexti = add nsw i32 %i, -1
+ %index32 = add nsw i32 %nexti, %max
+ %ptr = getelementptr inbounds float, float* %input, i32 %index32
+ %f = load float, float* %ptr, align 4
+ %exitcond = icmp eq i32 %nexti, %numIterations
+ br i1 %exitcond, label %exit, label %loop
+
+exit:
+ ret void
+}
+
+; CHECK-LABEL: @test-addrec-nsw-start-pos-strip-pos
+; CHECK: --> {(1 + (10 smax %offset))<nuw><nsw>,+,1}<nuw><nsw><%loop> U: [0,-2147483648) S: [0,-2147483648)
+define void @test-addrec-nsw-start-pos-strip-pos(float* %input, i32 %offset, i32 %numIterations) {
+entry:
+ %cmp = icmp sgt i32 %offset, 10
+ %min = select i1 %cmp, i32 %offset, i32 10
+ br label %loop
+loop:
+ %i = phi i32 [ %nexti, %loop ], [ 0, %entry ]
+ %nexti = add nsw i32 %i, 1
+ %index32 = add nsw i32 %nexti, %min
+ %ptr = getelementptr inbounds float, float* %input, i32 %index32
+ %f = load float, float* %ptr, align 4
+ %exitcond = icmp eq i32 %nexti, %numIterations
+ br i1 %exitcond, label %exit, label %loop
+
+exit:
+ ret void
+}
+
+; CHECK-LABEL: @test-addrec-nsw-start-neg-strip-pos
+; CHECK: --> {(1 + (-10 smax %offset))<nsw>,+,1}<nsw><%loop> U: full-set S: full-set
+define void @test-addrec-nsw-start-neg-strip-pos(float* %input, i32 %offset, i32 %numIterations) {
+entry:
+ %cmp = icmp sgt i32 %offset, -10
+ %min = select i1 %cmp, i32 %offset, i32 -10
+ br label %loop
+loop:
+ %i = phi i32 [ %nexti, %loop ], [ 0, %entry ]
+ %nexti = add nsw i32 %i, 1
+ %index32 = add nsw i32 %nexti, %min
+ %ptr = getelementptr inbounds float, float* %input, i32 %index32
+ %f = load float, float* %ptr, align 4
+ %exitcond = icmp eq i32 %nexti, %numIterations
+ br i1 %exitcond, label %exit, label %loop
+
+exit:
+ ret void
+}
+
More information about the llvm-commits
mailing list