1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt < %s -loop-reduce -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 6%struct.L = type { i8, ptr } 7 8declare i32 @__CxxFrameHandler3(...) 9 10@GV1 = external global ptr 11@GV2 = external global %struct.L 12 13define void @b_copy_ctor() personality ptr @__CxxFrameHandler3 { 14; CHECK-LABEL: @b_copy_ctor( 15; CHECK-NEXT: entry: 16; CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr @GV1, align 8 17; CHECK-NEXT: br label [[FOR_COND:%.*]] 18; CHECK: for.cond: 19; CHECK-NEXT: [[LSR_IV:%.*]] = phi i64 [ [[LSR_IV_NEXT:%.*]], [[CALL_I_NOEXC:%.*]] ], [ 0, [[ENTRY:%.*]] ] 20; CHECK-NEXT: [[LSR_IV2:%.*]] = inttoptr i64 [[LSR_IV]] to ptr 21; CHECK-NEXT: invoke void @a_copy_ctor() 22; CHECK-NEXT: to label [[CALL_I_NOEXC]] unwind label [[CATCH_DISPATCH:%.*]] 23; CHECK: call.i.noexc: 24; CHECK-NEXT: [[LSR_IV_NEXT]] = add i64 [[LSR_IV]], -16 25; CHECK-NEXT: br label [[FOR_COND]] 26; CHECK: catch.dispatch: 27; CHECK-NEXT: [[TMP2:%.*]] = catchswitch within none [label %catch] unwind to caller 28; CHECK: catch: 29; CHECK-NEXT: [[TMP3:%.*]] = catchpad within [[TMP2]] [ptr null, i32 64, ptr null] 30; CHECK-NEXT: [[CMP16:%.*]] = icmp eq ptr [[LSR_IV2]], null 31; CHECK-NEXT: [[TMP4:%.*]] = mul i64 [[LSR_IV]], -1 32; CHECK-NEXT: [[UGLYGEP:%.*]] = getelementptr i8, ptr [[TMP0]], i64 [[TMP4]] 33; CHECK-NEXT: br i1 [[CMP16]], label [[FOR_END:%.*]], label [[FOR_BODY_PREHEADER:%.*]] 34; CHECK: for.body.preheader: 35; CHECK-NEXT: br label [[FOR_BODY:%.*]] 36; CHECK: for.body: 37; CHECK-NEXT: [[CMP:%.*]] = icmp eq ptr [[UGLYGEP]], @GV2 38; CHECK-NEXT: br i1 [[CMP]], label [[FOR_END_LOOPEXIT:%.*]], label [[FOR_BODY]] 39; CHECK: for.end.loopexit: 40; CHECK-NEXT: br label [[FOR_END]] 41; CHECK: for.end: 42; CHECK-NEXT: catchret from [[TMP3]] to label [[TRY_CONT:%.*]] 43; CHECK: try.cont: 44; CHECK-NEXT: ret void 45; 46entry: 47 %0 = load ptr, ptr @GV1, align 8 48 br label %for.cond 49 50for.cond: ; preds = %call.i.noexc, %entry 51 %d.0 = phi ptr [ %0, %entry ], [ %incdec.ptr, %call.i.noexc ] 52 invoke void @a_copy_ctor() 53 to label %call.i.noexc unwind label %catch.dispatch 54 55call.i.noexc: ; preds = %for.cond 56 %incdec.ptr = getelementptr inbounds %struct.L, ptr %d.0, i64 1 57 br label %for.cond 58 59catch.dispatch: ; preds = %for.cond 60 %1 = catchswitch within none [label %catch] unwind to caller 61 62catch: ; preds = %catch.dispatch 63 %2 = catchpad within %1 [ptr null, i32 64, ptr null] 64 %cmp16 = icmp eq ptr %0, %d.0 65 br i1 %cmp16, label %for.end, label %for.body 66 67for.body: ; preds = %for.body, %catch 68 %cmp = icmp eq ptr @GV2, %d.0 69 br i1 %cmp, label %for.end, label %for.body 70 71for.end: ; preds = %for.body, %catch 72 catchret from %2 to label %try.cont 73 74try.cont: ; preds = %for.end 75 ret void 76} 77 78declare void @a_copy_ctor() 79