53 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt -passes=instcombine -S < %s | FileCheck %s3target triple = "x86_64-pc-windows-msvc"4 5define i1 @test1(ptr %p) personality ptr @__CxxFrameHandler3 {6; CHECK-LABEL: @test1(7; CHECK-NEXT: entry:8; CHECK-NEXT: [[A:%.*]] = getelementptr i8, ptr [[P:%.*]], i64 19; CHECK-NEXT: invoke void @may_throw()10; CHECK-NEXT: to label [[INVOKE_CONT:%.*]] unwind label [[CATCH_DISPATCH:%.*]]11; CHECK: invoke.cont:12; CHECK-NEXT: [[B:%.*]] = getelementptr i8, ptr [[P]], i64 213; CHECK-NEXT: invoke void @may_throw()14; CHECK-NEXT: to label [[EXIT:%.*]] unwind label [[CATCH_DISPATCH]]15; CHECK: catch.dispatch:16; CHECK-NEXT: [[C:%.*]] = phi ptr [ [[B]], [[INVOKE_CONT]] ], [ [[A]], [[ENTRY:%.*]] ]17; CHECK-NEXT: [[TMP1:%.*]] = catchswitch within none [label %catch] unwind to caller18; CHECK: catch:19; CHECK-NEXT: [[TMP2:%.*]] = catchpad within [[TMP1]] [ptr null, i32 64, ptr null]20; CHECK-NEXT: catchret from [[TMP2]] to label [[EXIT]]21; CHECK: exit:22; CHECK-NEXT: [[D:%.*]] = phi ptr [ [[A]], [[INVOKE_CONT]] ], [ [[C]], [[CATCH:%.*]] ]23; CHECK-NEXT: [[CMP:%.*]] = icmp eq ptr [[D]], [[A]]24; CHECK-NEXT: ret i1 [[CMP]]25;26entry:27 %a = getelementptr i8, ptr %p, i64 128 invoke void @may_throw()29 to label %invoke.cont unwind label %catch.dispatch30 31invoke.cont:32 %b = getelementptr inbounds i8, ptr %a, i64 133 invoke void @may_throw()34 to label %exit unwind label %catch.dispatch35 36catch.dispatch:37 %c = phi ptr [ %b, %invoke.cont ], [ %a, %entry ]38 %tmp1 = catchswitch within none [label %catch] unwind to caller39 40catch:41 %tmp2 = catchpad within %tmp1 [ptr null, i32 64, ptr null]42 catchret from %tmp2 to label %exit43 44exit:45 %d = phi ptr [ %a, %invoke.cont ], [ %c, %catch ]46 %cmp = icmp eq ptr %d, %a47 ret i1 %cmp48}49 50declare void @may_throw()51 52declare i32 @__CxxFrameHandler3(...)53