Home | History | Annotate | Download | only in IndVarSimplify
      1 ; RUN: opt < %s -indvars -S | FileCheck %s
      2 ; PR13371: indvars pass incorrectly substitutes 'undef' values
      3 ;
      4 ; LFTR should not user %undef as the loop counter.
      5 ; CHECK-LABEL: @test(
      6 ; CHECK-NOT: icmp{{.*}}undef
      7 @.str3 = private constant [6 x i8] c"%lld\0A\00", align 1
      8 declare i32 @printf(i8* noalias nocapture, ...) nounwind
      9 define i64 @test() nounwind {
     10 func_start:
     11   br label %block9
     12 block9:                                           ; preds = %block9,%func_start
     13   %undef = phi i64 [ %next_undef, %block9 ], [ undef, %func_start ]
     14   %iter = phi i64 [ %next_iter, %block9 ], [ 1, %func_start ]
     15   %next_iter = add nsw i64 %iter, 1
     16   %0 = tail call i32 (i8*, ...)* @printf(i8* noalias nocapture getelementptr inbounds ([6 x i8]* @.str3, i64 0, i64 0), i64 %next_iter, i64 %undef)
     17   %next_undef = add nsw i64 %undef, 1
     18   %_tmp_3 = icmp slt i64 %next_iter, 100
     19   br i1 %_tmp_3, label %block9, label %exit
     20 exit:                                             ; preds = %block9
     21   ret i64 0
     22 }
     23