summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZheng Chen <czhengsz@cn.ibm.com>2020-01-09 01:24:22 -0500
committerZheng Chen <czhengsz@cn.ibm.com>2020-01-09 01:26:57 -0500
commit4ebb589629b0d3de0827cab179338836ebb3a8b6 (patch)
treec36f3774946de23717c1c9518531e18468c1332a
parent51bdd98b8a52d07004bcaddff26caf376a1c32bf (diff)
downloadbcm5719-llvm-4ebb589629b0d3de0827cab179338836ebb3a8b6.tar.gz
bcm5719-llvm-4ebb589629b0d3de0827cab179338836ebb3a8b6.zip
[SCEV] [NFC] add testcase for constant range for addrecexpr with nsw flag
-rw-r--r--llvm/test/Analysis/ScalarEvolution/range_nw_flag.ll19
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/test/Analysis/ScalarEvolution/range_nw_flag.ll b/llvm/test/Analysis/ScalarEvolution/range_nw_flag.ll
index 65ecd312e0c..4a520056d76 100644
--- a/llvm/test/Analysis/ScalarEvolution/range_nw_flag.ll
+++ b/llvm/test/Analysis/ScalarEvolution/range_nw_flag.ll
@@ -39,3 +39,22 @@ exit:
ret void
}
+; CHECK-LABEL: @test-addrec-nsw
+; 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) {
+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
+}
OpenPOWER on IntegriCloud