1; RUN: opt < %s -instcombine -S | FileCheck %s 2target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" 3target triple = "x86_64-pc-windows-msvc18.0.0" 4 5declare i32 @__CxxFrameHandler3(...) 6 7define void @test1() personality i32 (...)* @__CxxFrameHandler3 { 8bb: 9 unreachable 10 11unreachable: 12 %cl = cleanuppad within none [] 13 cleanupret from %cl unwind to caller 14} 15 16; CHECK-LABEL: define void @test1( 17; CHECK: unreachable: 18; CHECK: %cl = cleanuppad within none [] 19; CHECK: cleanupret from %cl unwind to caller 20 21define void @test2(i8 %A, i8 %B) personality i32 (...)* @__CxxFrameHandler3 { 22bb: 23 %X = zext i8 %A to i32 24 invoke void @g(i32 0) 25 to label %cont 26 unwind label %catch 27 28cont: 29 %Y = zext i8 %B to i32 30 invoke void @g(i32 0) 31 to label %unreachable 32 unwind label %catch 33 34catch: 35 %phi = phi i32 [ %X, %bb ], [ %Y, %cont ] 36 %cs = catchswitch within none [label %doit] unwind to caller 37 38doit: 39 %cl = catchpad within %cs [] 40 call void @g(i32 %phi) 41 unreachable 42 43unreachable: 44 unreachable 45} 46 47; CHECK-LABEL: define void @test2( 48; CHECK: %X = zext i8 %A to i32 49; CHECK: %Y = zext i8 %B to i32 50; CHECK: %phi = phi i32 [ %X, %bb ], [ %Y, %cont ] 51 52define void @test3(i8 %A, i8 %B) personality i32 (...)* @__CxxFrameHandler3 { 53bb: 54 %X = zext i8 %A to i32 55 invoke void @g(i32 0) 56 to label %cont 57 unwind label %catch 58 59cont: 60 %Y = zext i8 %B to i32 61 invoke void @g(i32 0) 62 to label %cont2 63 unwind label %catch 64 65cont2: 66 invoke void @g(i32 0) 67 to label %unreachable 68 unwind label %catch 69 70catch: 71 %phi = phi i32 [ %X, %bb ], [ %Y, %cont ], [ %Y, %cont2 ] 72 %cs = catchswitch within none [label %doit] unwind to caller 73 74doit: 75 %cl = catchpad within %cs [] 76 call void @g(i32 %phi) 77 unreachable 78 79unreachable: 80 unreachable 81} 82 83; CHECK-LABEL: define void @test3( 84; CHECK: %X = zext i8 %A to i32 85; CHECK: %Y = zext i8 %B to i32 86; CHECK: %phi = phi i32 [ %X, %bb ], [ %Y, %cont ], [ %Y, %cont2 ] 87 88declare void @foo() 89declare token @llvm.experimental.gc.statepoint.p0f_isVoidf(i64, i32, void ()*, i32, i32, ...) 90 91define void @test4(i8 addrspace(1)* %obj) gc "statepoint-example" { 92bb: 93 unreachable 94 95unreachable: 96 call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @foo, i32 0, i32 0, i32 0, i32 5, i32 0, i32 -1, i32 0, i32 0, i32 0) 97 ret void 98} 99 100; CHECK-LABEL: define void @test4( 101; CHECK: unreachable: 102; CHECK: call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @foo, i32 0, i32 0, i32 0, i32 5, i32 0, i32 -1, i32 0, i32 0, i32 0) 103; CHECK: ret void 104 105 106declare void @g(i32) 107