Home | History | Annotate | Download | only in InstCombine
      1 ; RUN: opt -instcombine -S < %s | FileCheck %s
      2 target triple = "x86_64-pc-windows-msvc"
      3 
      4 define i1 @test1(i8* %p) personality i32 (...)* @__CxxFrameHandler3 {
      5 entry:
      6   %a = getelementptr i8, i8* %p, i64 1
      7   invoke void @may_throw()
      8           to label %invoke.cont unwind label %catch.dispatch
      9 
     10 invoke.cont:
     11   %b = getelementptr inbounds i8, i8* %a, i64 1
     12   invoke void @may_throw()
     13           to label %exit unwind label %catch.dispatch
     14 
     15 catch.dispatch:
     16   %c = phi i8* [ %b, %invoke.cont ], [ %a, %entry ]
     17   %tmp1 = catchswitch within none [label %catch] unwind to caller
     18 
     19 catch:
     20   %tmp2 = catchpad within %tmp1 [i8* null, i32 64, i8* null]
     21   catchret from %tmp2 to label %exit
     22 
     23 exit:
     24   %d = phi i8* [ %a, %invoke.cont ], [ %c, %catch ]
     25   %cmp = icmp eq i8* %d, %a
     26   ret i1 %cmp
     27 }
     28 
     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
     34 
     35 declare void @may_throw()
     36 
     37 declare i32 @__CxxFrameHandler3(...)
     38