1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt -passes=indvars -S < %s | FileCheck %s 3target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" 4target triple = "x86_64-pc-windows-msvc18.0.0" 5 6define i32 @fn2() personality ptr @__CxxFrameHandler3 { 7; CHECK-LABEL: @fn2( 8; CHECK-NEXT: entry: 9; CHECK-NEXT: br label [[FOR_COND:%.*]] 10; CHECK: for.cond: 11; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_INC:%.*]] ], [ 0, [[ENTRY:%.*]] ] 12; CHECK-NEXT: [[INDVARS1:%.*]] = trunc i64 [[INDVARS_IV]] to i32 13; CHECK-NEXT: invoke void @fn1(i64 [[INDVARS_IV]]) 14; CHECK-NEXT: to label [[FOR_INC]] unwind label [[CATCH_DISPATCH:%.*]] 15; CHECK: catch.dispatch: 16; CHECK-NEXT: [[C_0_LCSSA:%.*]] = phi i32 [ [[INDVARS1]], [[FOR_COND]] ] 17; CHECK-NEXT: [[TMP0:%.*]] = catchswitch within none [label %catch] unwind to caller 18; CHECK: catch: 19; CHECK-NEXT: [[TMP1:%.*]] = catchpad within [[TMP0]] [ptr null, i32 64, ptr null] 20; CHECK-NEXT: catchret from [[TMP1]] to label [[EXIT:%.*]] 21; CHECK: exit: 22; CHECK-NEXT: ret i32 [[C_0_LCSSA]] 23; CHECK: for.inc: 24; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1 25; CHECK-NEXT: br label [[FOR_COND]] 26; 27entry: 28 br label %for.cond 29 30for.cond: ; preds = %for.inc, %entry 31 %c.0 = phi i32 [ %inc, %for.inc ], [ 0, %entry ] 32 %idxprom = sext i32 %c.0 to i64 33 invoke void @fn1(i64 %idxprom) 34 to label %for.inc unwind label %catch.dispatch 35 36catch.dispatch: ; preds = %for.cond 37 %c.0.lcssa = phi i32 [ %c.0, %for.cond ] 38 %0 = catchswitch within none [label %catch] unwind to caller 39 40catch: ; preds = %catch.dispatch 41 %1 = catchpad within %0 [ptr null, i32 64, ptr null] 42 catchret from %1 to label %exit 43 44exit: 45 ret i32 %c.0.lcssa 46 47for.inc: ; preds = %for.cond 48 %inc = add nsw nuw i32 %c.0, 1 49 br label %for.cond 50} 51 52declare void @fn1(i64 %idxprom) 53 54declare i32 @__CxxFrameHandler3(...) 55