• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -analyze -enable-new-pm=0 -scalar-evolution -scev-addops-inline-threshold=1 < %s | FileCheck --check-prefix=CHECK1 %s
2; RUN: opt -disable-output "-passes=print<scalar-evolution>" -scev-addops-inline-threshold=1 < %s 2>&1 | FileCheck --check-prefix=CHECK1 %s
3; RUN: opt -analyze -enable-new-pm=0 -scalar-evolution -scev-addops-inline-threshold=10 < %s | FileCheck --check-prefix=CHECK10 %s
4; RUN: opt -disable-output "-passes=print<scalar-evolution>" -scev-addops-inline-threshold=10 < %s 2>&1 | FileCheck --check-prefix=CHECK10 %s
5
6define i32 @foo(i64 %p0, i32 %p1) {
7; CHECK1: %add2 = add nsw i32 %mul1, %add
8; CHECK1-NEXT: -->  ((trunc i64 %p0 to i32) * (1 + (trunc i64 %p0 to i32)) * (1 + %p1))
9
10; CHECK10: %add2 = add nsw i32 %mul1, %add
11; CHECK10-NEXT: -->  ((trunc i64 %p0 to i32) * (1 + ((trunc i64 %p0 to i32) * (1 + %p1)) + %p1))
12entry:
13  %tr = trunc i64 %p0 to i32
14  %mul = mul nsw i32 %tr, %p1
15  %add = add nsw i32 %mul, %tr
16  %mul1 = mul nsw i32 %add, %tr
17  %add2 = add nsw i32 %mul1, %add
18  ret i32 %add2
19}
20