Home | History | Annotate | Download | only in WinEH
      1 ; RUN: sed -e s/.Cxx:// %s | opt -mtriple=x86-pc-windows-msvc -S -x86-winehstate | FileCheck %s
      2 ; RUN: sed -e s/.SEH:// %s | opt -mtriple=x86-pc-windows-msvc -S -x86-winehstate | FileCheck %s
      3 
      4 declare i32 @__CxxFrameHandler3(...)
      5 declare i32 @_except_handler3(...)
      6 declare void @dummy_filter()
      7 
      8 declare void @f(i32)
      9 
     10 ; CHECK-LABEL: define void @test2(
     11 ;Cxx: define void @test2(i1 %b) personality i32 (...)* @__CxxFrameHandler3 {
     12 ;SEH: define void @test2(i1 %b) personality i32 (...)* @_except_handler3 {
     13 entry:
     14   ; CHECK: entry:
     15   ; CHECK:   store i32 1
     16   ; CHECK:   invoke void @f(i32 1)
     17   invoke void @f(i32 1)
     18     to label %exit unwind label %cleanup.pad
     19 cleanup.pad:
     20   %cleanup = cleanuppad within none []
     21   br i1 %b, label %left, label %right
     22 left:
     23   cleanupret from %cleanup unwind label %catch.pad
     24 right:
     25   cleanupret from %cleanup unwind label %catch.pad
     26 catch.pad:
     27   %cs1 = catchswitch within none [label %catch.body] unwind to caller
     28 catch.body:
     29 ;Cxx: %catch = catchpad within %cs1 [i8* null, i32 u0x40, i8* null]
     30 ;SEH: %catch = catchpad within %cs1 [void ()* @dummy_filter]
     31   catchret from %catch to label %exit
     32 exit:
     33   ret void
     34 }
     35 
     36 ; CHECK-LABEL: define void @test3(
     37 ;Cxx: define void @test3() personality i32 (...)* @__CxxFrameHandler3 {
     38 ;SEH: define void @test3() personality i32 (...)* @_except_handler3 {
     39 entry:
     40   ; CHECK: entry:
     41   ; CHECK:   store i32 0
     42   ; CHECK:   invoke void @f(i32 1)
     43   invoke void @f(i32 1)
     44     to label %exit unwind label %cleanup.pad
     45 cleanup.pad:
     46   ; CHECK: cleanup.pad:
     47   ; CHECK:   invoke void @f(i32 0)
     48   %cleanup = cleanuppad within none []
     49   invoke void @f(i32 0)
     50     to label %unreachable unwind label %catch.pad
     51 unreachable:
     52   unreachable
     53 catch.pad:
     54   %cs1 = catchswitch within none [label %catch.body] unwind to caller
     55 catch.body:
     56 ;Cxx: %catch = catchpad within %cs1 [i8* null, i32 u0x40, i8* null]
     57 ;SEH: %catch = catchpad within %cs1 [void ()* @dummy_filter]
     58   catchret from %catch to label %exit
     59 exit:
     60   ret void
     61 }
     62