1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt -instcombine -S < %s | FileCheck %s 3target triple = "x86_64-pc-windows-msvc" 4 5define i1 @test1(i8* %p) personality i32 (...)* @__CxxFrameHandler3 { 6; CHECK-LABEL: @test1( 7; CHECK-NEXT: entry: 8; CHECK-NEXT: [[A:%.*]] = getelementptr i8, i8* [[P:%.*]], i64 1 9; 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, i8* [[P]], i64 2 13; 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 i8* [ [[B]], [[INVOKE_CONT]] ], [ [[A]], [[ENTRY:%.*]] ] 17; CHECK-NEXT: [[TMP1:%.*]] = catchswitch within none [label %catch] unwind to caller 18; CHECK: catch: 19; CHECK-NEXT: [[TMP2:%.*]] = catchpad within [[TMP1]] [i8* null, i32 64, i8* null] 20; CHECK-NEXT: catchret from [[TMP2]] to label [[EXIT]] 21; CHECK: exit: 22; CHECK-NEXT: [[D:%.*]] = phi i8* [ [[A]], [[INVOKE_CONT]] ], [ [[C]], [[CATCH:%.*]] ] 23; CHECK-NEXT: [[CMP:%.*]] = icmp eq i8* [[D]], [[A]] 24; CHECK-NEXT: ret i1 [[CMP]] 25; 26entry: 27 %a = getelementptr i8, i8* %p, i64 1 28 invoke void @may_throw() 29 to label %invoke.cont unwind label %catch.dispatch 30 31invoke.cont: 32 %b = getelementptr inbounds i8, i8* %a, i64 1 33 invoke void @may_throw() 34 to label %exit unwind label %catch.dispatch 35 36catch.dispatch: 37 %c = phi i8* [ %b, %invoke.cont ], [ %a, %entry ] 38 %tmp1 = catchswitch within none [label %catch] unwind to caller 39 40catch: 41 %tmp2 = catchpad within %tmp1 [i8* null, i32 64, i8* null] 42 catchret from %tmp2 to label %exit 43 44exit: 45 %d = phi i8* [ %a, %invoke.cont ], [ %c, %catch ] 46 %cmp = icmp eq i8* %d, %a 47 ret i1 %cmp 48} 49 50declare void @may_throw() 51 52declare i32 @__CxxFrameHandler3(...) 53