1 ; RUN: opt < %s -indvars -S | FileCheck %s
3 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128-ni:1"
4 target triple = "x86_64-unknown-linux-gnu"
9 define void @test(i64 %a) {
11 br label %outer_header
14 %i = phi i64 [20, %entry], [%i.next, %outer_latch]
15 %i.next = add nuw nsw i64 %i, 1
16 br label %inner_header
19 %j = phi i64 [1, %outer_header], [%j.next, %inner_header]
20 %cmp = icmp ult i64 %j, %i.next
22 %s = select i1 %cmp, i64 %j, i64 %i
23 ; CHECK: call void @foo(i64 %j)
24 call void @foo(i64 %s)
25 %j.next = add nuw nsw i64 %j, 1
26 %cond = icmp ult i64 %j, %i
27 br i1 %cond, label %inner_header, label %outer_latch
30 %cond2 = icmp ne i64 %i.next, 40
31 br i1 %cond2, label %outer_header, label %return