1; RUN: opt < %s -indvars -S | FileCheck %s 2 3target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128-ni:1" 4target triple = "x86_64-unknown-linux-gnu" 5 6declare void @foo(i64) 7 8; CHECK-LABEL: @test 9define void @test(i64 %a) { 10entry: 11 br label %outer_header 12 13outer_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 17 18inner_header: 19 %j = phi i64 [1, %outer_header], [%j.next, %inner_header] 20 %cmp = icmp ult i64 %j, %i.next 21; CHECK-NOT: select 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 28 29outer_latch: 30 %cond2 = icmp ne i64 %i.next, 40 31 br i1 %cond2, label %outer_header, label %return 32 33return: 34 ret void 35} 36