1 ; RUN: opt -instcombine -S < %s | FileCheck %s
2 target triple = "x86_64-pc-windows-msvc"
4 define i1 @test1(i8* %p) personality i32 (...)* @__CxxFrameHandler3 {
6 %a = getelementptr i8, i8* %p, i64 1
7 invoke void @may_throw()
8 to label %invoke.cont unwind label %catch.dispatch
11 %b = getelementptr inbounds i8, i8* %a, i64 1
12 invoke void @may_throw()
13 to label %exit unwind label %catch.dispatch
16 %c = phi i8* [ %b, %invoke.cont ], [ %a, %entry ]
17 %tmp1 = catchswitch within none [label %catch] unwind to caller
20 %tmp2 = catchpad within %tmp1 [i8* null, i32 64, i8* null]
21 catchret from %tmp2 to label %exit
24 %d = phi i8* [ %a, %invoke.cont ], [ %c, %catch ]
25 %cmp = icmp eq i8* %d, %a
29 ; CHECK-LABEL: define i1 @test1(
30 ; CHECK: %[[gep_a:.*]] = getelementptr i8, i8* %p, i64 1
31 ; CHECK: %[[gep_b:.*]] = getelementptr inbounds i8, i8* %p, i64 2
32 ; CHECK: phi i8* [ %[[gep_b]], {{.*}} ], [ %[[gep_a]], {{.*}} ]
33 ; CHECK: %tmp1 = catchswitch within none [label %catch] unwind to caller
35 declare void @may_throw()
37 declare i32 @__CxxFrameHandler3(...)