1 ; RUN: opt < %s -indvars -S | FileCheck %s 2 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" 3 4 ; CHECK-LABEL: @foo 5 define void @foo() { 6 entry: 7 br label %L1_header 8 9 L1_header: 10 br label %L2_header 11 12 ; CHECK: L2_header: 13 ; CHECK: %[[INDVAR:.*]] = phi i64 14 ; CHECK: %[[TRUNC:.*]] = trunc i64 %[[INDVAR]] to i32 15 L2_header: 16 %i = phi i32 [ 0, %L1_header ], [ %i_next, %L2_latch ] 17 %i_prom = sext i32 %i to i64 18 br label %L3_header 19 20 L3_header: 21 br i1 undef, label %L3_latch, label %L2_exiting_1 22 23 L3_latch: 24 br i1 undef, label %L3_header, label %L2_exiting_2 25 26 L2_exiting_1: 27 br i1 undef, label %L2_latch, label %L1_latch 28 29 L2_exiting_2: 30 br i1 undef, label %L2_latch, label %L1_latch 31 32 L2_latch: 33 %i_next = add nsw i32 %i, 1 34 br label %L2_header 35 36 L1_latch: 37 ; CHECK: L1_latch: 38 ; CHECK: %i_lcssa = phi i32 [ %[[TRUNC]], %L2_exiting_1 ], [ %[[TRUNC]], %L2_exiting_2 ] 39 40 %i_lcssa = phi i32 [ %i, %L2_exiting_1 ], [ %i, %L2_exiting_2 ] 41 br i1 undef, label %exit, label %L1_header 42 43 exit: 44 ret void 45 } 46