| ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py |
| ; RUN: opt < %s -loop-reduce -S | FileCheck %s |
| target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" |
| target triple = "x86_64-pc-windows-msvc18.0.0" |
| |
| %struct.L = type { i8, ptr } |
| |
| declare i32 @__CxxFrameHandler3(...) |
| |
| @GV1 = external global ptr |
| @GV2 = external global %struct.L |
| |
| define void @b_copy_ctor() personality ptr @__CxxFrameHandler3 { |
| ; CHECK-LABEL: @b_copy_ctor( |
| ; CHECK-NEXT: entry: |
| ; CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr @GV1, align 8 |
| ; CHECK-NEXT: br label [[FOR_COND:%.*]] |
| ; CHECK: for.cond: |
| ; CHECK-NEXT: [[LSR_IV:%.*]] = phi i64 [ [[LSR_IV_NEXT:%.*]], [[CALL_I_NOEXC:%.*]] ], [ 0, [[ENTRY:%.*]] ] |
| ; CHECK-NEXT: [[LSR_IV2:%.*]] = inttoptr i64 [[LSR_IV]] to ptr |
| ; CHECK-NEXT: invoke void @a_copy_ctor() |
| ; CHECK-NEXT: to label [[CALL_I_NOEXC]] unwind label [[CATCH_DISPATCH:%.*]] |
| ; CHECK: call.i.noexc: |
| ; CHECK-NEXT: [[LSR_IV_NEXT]] = add i64 [[LSR_IV]], -16 |
| ; CHECK-NEXT: br label [[FOR_COND]] |
| ; CHECK: catch.dispatch: |
| ; CHECK-NEXT: [[TMP2:%.*]] = catchswitch within none [label %catch] unwind to caller |
| ; CHECK: catch: |
| ; CHECK-NEXT: [[TMP3:%.*]] = catchpad within [[TMP2]] [ptr null, i32 64, ptr null] |
| ; CHECK-NEXT: [[CMP16:%.*]] = icmp eq ptr [[LSR_IV2]], null |
| ; CHECK-NEXT: [[TMP4:%.*]] = mul i64 [[LSR_IV]], -1 |
| ; CHECK-NEXT: [[UGLYGEP:%.*]] = getelementptr i8, ptr [[TMP0]], i64 [[TMP4]] |
| ; CHECK-NEXT: br i1 [[CMP16]], label [[FOR_END:%.*]], label [[FOR_BODY_PREHEADER:%.*]] |
| ; CHECK: for.body.preheader: |
| ; CHECK-NEXT: br label [[FOR_BODY:%.*]] |
| ; CHECK: for.body: |
| ; CHECK-NEXT: [[CMP:%.*]] = icmp eq ptr [[UGLYGEP]], @GV2 |
| ; CHECK-NEXT: br i1 [[CMP]], label [[FOR_END_LOOPEXIT:%.*]], label [[FOR_BODY]] |
| ; CHECK: for.end.loopexit: |
| ; CHECK-NEXT: br label [[FOR_END]] |
| ; CHECK: for.end: |
| ; CHECK-NEXT: catchret from [[TMP3]] to label [[TRY_CONT:%.*]] |
| ; CHECK: try.cont: |
| ; CHECK-NEXT: ret void |
| ; |
| entry: |
| %0 = load ptr, ptr @GV1, align 8 |
| br label %for.cond |
| |
| for.cond: ; preds = %call.i.noexc, %entry |
| %d.0 = phi ptr [ %0, %entry ], [ %incdec.ptr, %call.i.noexc ] |
| invoke void @a_copy_ctor() |
| to label %call.i.noexc unwind label %catch.dispatch |
| |
| call.i.noexc: ; preds = %for.cond |
| %incdec.ptr = getelementptr inbounds %struct.L, ptr %d.0, i64 1 |
| br label %for.cond |
| |
| catch.dispatch: ; preds = %for.cond |
| %1 = catchswitch within none [label %catch] unwind to caller |
| |
| catch: ; preds = %catch.dispatch |
| %2 = catchpad within %1 [ptr null, i32 64, ptr null] |
| %cmp16 = icmp eq ptr %0, %d.0 |
| br i1 %cmp16, label %for.end, label %for.body |
| |
| for.body: ; preds = %for.body, %catch |
| %cmp = icmp eq ptr @GV2, %d.0 |
| br i1 %cmp, label %for.end, label %for.body |
| |
| for.end: ; preds = %for.body, %catch |
| catchret from %2 to label %try.cont |
| |
| try.cont: ; preds = %for.end |
| ret void |
| } |
| |
| declare void @a_copy_ctor() |