1 ; RUN: opt < %s -indvars -S | FileCheck %s
2 ; PR13371: indvars pass incorrectly substitutes 'undef' values
4 ; LFTR should not user %undef as the loop counter.
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 {
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