Home | History | Annotate | Download | only in ScalarEvolution
      1 ; RUN: opt -analyze -scalar-evolution < %s | FileCheck %s
      2 
      3 declare i1 @use(i64)
      4 
      5 define void @f_0() {
      6 ; CHECK-LABEL: Classifying expressions for: @f_0
      7 
      8 ; CHECK:  %iv = phi i32 [ 0, %entry ], [ %iv.inc.nowrap, %be ]
      9 ; CHECK-NEXT: -->  {0,+,1}<nuw><nsw><%loop>
     10 ; CHECK: %iv.inc.maywrap = add i32 %iv, 1
     11 ; CHECK-NEXT: -->  {1,+,1}<nuw><%loop>
     12 ; CHECK:  %iv.inc.maywrap.sext = sext i32 %iv.inc.maywrap to i64
     13 ; CHECK-NEXT:  -->  (sext i32 {1,+,1}<nuw><%loop> to i64)
     14 entry:
     15   br label %loop
     16 
     17 loop:
     18   %iv = phi i32 [ 0, %entry ], [ %iv.inc.nowrap, %be ]
     19   %iv.inc.maywrap = add i32 %iv, 1
     20   %iv.inc.maywrap.sext = sext i32 %iv.inc.maywrap to i64
     21   %cond0 = call i1 @use(i64 %iv.inc.maywrap.sext)
     22   br i1 %cond0, label %be, label %leave
     23 
     24 be:
     25   %iv.inc.nowrap = add nsw i32 %iv, 1
     26   %be.cond = call i1 @use(i64 0) ;; Get an unanalyzable value
     27   br i1 %be.cond, label %loop, label %leave
     28 
     29 leave:
     30   ret void
     31 }
     32