Home | History | Annotate | Download | only in ScalarEvolution
      1 ; RUN: opt -analyze -scalar-evolution < %s | FileCheck %s
      2 
      3 define void @f(i1* %condition) {
      4 ; CHECK-LABEL: Classifying expressions for: @f
      5  entry: 
      6   br label %loop
      7 
      8  loop:
      9   %idx = phi i32 [ 0, %entry ], [ %idx.inc, %loop ]
     10   %idx.inc = add nsw i32 %idx, 1
     11 
     12   %idx.inc2 = add i32 %idx.inc, 1
     13   %idx.inc2.zext = zext i32 %idx.inc2 to i64
     14 
     15 ; CHECK: %idx.inc2.zext = zext i32 %idx.inc2 to i64
     16 ; CHECK-NEXT: -->  {2,+,1}<nuw><%loop>
     17 
     18   %c = load volatile i1, i1* %condition
     19   br i1 %c, label %loop, label %exit
     20 
     21  exit:
     22   ret void
     23 }
     24 
     25 define void @g(i1* %condition) {
     26 ; CHECK-LABEL: Classifying expressions for: @g
     27  entry:
     28   br label %loop
     29 
     30  loop:
     31   %idx = phi i32 [ 0, %entry ], [ %idx.inc, %loop ]
     32   %idx.inc = add nsw i32 %idx, 3
     33 
     34   %idx.inc2 = add i32 %idx.inc, -1
     35   %idx.inc2.sext = sext i32 %idx.inc2 to i64
     36 ; CHECK: %idx.inc2.sext = sext i32 %idx.inc2 to i64
     37 ; CHECK-NEXT: -->  {2,+,3}<nuw><nsw><%loop>
     38 
     39   %c = load volatile i1, i1* %condition
     40   br i1 %c, label %loop, label %exit
     41 
     42  exit:
     43   ret void
     44 }
     45