Home | History | Annotate | Download | only in PruneEH
      1 ; RUN: opt -S -prune-eh < %s | FileCheck %s
      2 ; RUN: opt -S -passes='function-attrs,function(simplify-cfg)' < %s | FileCheck %s
      3 
      4 declare void @may_throw()
      5 
      6 ; @callee below may be an optimized form of this function, which can
      7 ; throw at runtime (see r265762 for more details):
      8 ; 
      9 ; define linkonce_odr void @callee(i32* %ptr) noinline {
     10 ; entry:
     11 ;   %val0 = load atomic i32, i32* %ptr unordered, align 4
     12 ;   %val1 = load atomic i32, i32* %ptr unordered, align 4
     13 ;   %cmp = icmp eq i32 %val0, %val1
     14 ;   br i1 %cmp, label %left, label %right
     15 
     16 ; left:
     17 ;   ret void
     18 
     19 ; right:
     20 ;   call void @may_throw()
     21 ;   ret void
     22 ; }
     23 
     24 define linkonce_odr void @callee(i32* %ptr) noinline {
     25   ret void
     26 }
     27 
     28 define i32 @caller(i32* %ptr) personality i32 3 {
     29 ; CHECK-LABEL: @caller(
     30 ; CHECK:  invoke void @callee(i32* %ptr)
     31 ; CHECK-NEXT:          to label %normal unwind label %unwind
     32 
     33 entry:
     34   invoke void @callee(i32* %ptr)
     35           to label %normal unwind label %unwind
     36 
     37 normal:
     38   ret i32 1
     39 
     40 unwind:
     41   %res = landingpad { i8*, i32 }
     42          cleanup
     43   ret i32 2
     44 }
     45