aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis/ScalarEvolution/max-addops-inline.ll
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-04-16 16:01:22 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-04-16 16:01:22 +0000
commit71d5a2540a98c81f5bcaeb48805e0e2881f530ef (patch)
tree5343938942df402b49ec7300a1c25a2d4ccd5821 /test/Analysis/ScalarEvolution/max-addops-inline.ll
parent31bbf64f3a4974a2d6c8b3b27ad2f519caf74057 (diff)
Diffstat (limited to 'test/Analysis/ScalarEvolution/max-addops-inline.ll')
-rw-r--r--test/Analysis/ScalarEvolution/max-addops-inline.ll17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/Analysis/ScalarEvolution/max-addops-inline.ll b/test/Analysis/ScalarEvolution/max-addops-inline.ll
new file mode 100644
index 000000000000..2701ed32839f
--- /dev/null
+++ b/test/Analysis/ScalarEvolution/max-addops-inline.ll
@@ -0,0 +1,17 @@
+; RUN: opt -analyze -scalar-evolution -scev-addops-inline-threshold=1 < %s | FileCheck --check-prefix=CHECK1 %s
+; RUN: opt -analyze -scalar-evolution -scev-addops-inline-threshold=10 < %s | FileCheck --check-prefix=CHECK10 %s
+
+define i32 @foo(i64 %p0, i32 %p1) {
+; CHECK1: %add2 = add nsw i32 %mul1, %add
+; CHECK1-NEXT: --> ((trunc i64 %p0 to i32) * (1 + (trunc i64 %p0 to i32)) * (1 + %p1))
+
+; CHECK10: %add2 = add nsw i32 %mul1, %add
+; CHECK10-NEXT: --> ((trunc i64 %p0 to i32) * (1 + ((trunc i64 %p0 to i32) * (1 + %p1)) + %p1))
+entry:
+ %tr = trunc i64 %p0 to i32
+ %mul = mul nsw i32 %tr, %p1
+ %add = add nsw i32 %mul, %tr
+ %mul1 = mul nsw i32 %add, %tr
+ %add2 = add nsw i32 %mul1, %add
+ ret i32 %add2
+}