107 lines · plain
1; RUN: opt < %s -passes=instcombine -S | FileCheck %s2target 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 ptr @__CxxFrameHandler3 {8bb:9 unreachable10 11unreachable:12 %cl = cleanuppad within none []13 cleanupret from %cl unwind to caller14}15 16; CHECK-LABEL: define void @test1(17; CHECK: unreachable:18; CHECK: %cl = cleanuppad within none []19; CHECK: cleanupret from %cl unwind to caller20 21define void @test2(i8 %A, i8 %B) personality ptr @__CxxFrameHandler3 {22bb:23 %X = zext i8 %A to i3224 invoke void @g(i32 0)25 to label %cont26 unwind label %catch27 28cont:29 %Y = zext i8 %B to i3230 invoke void @g(i32 0)31 to label %unreachable32 unwind label %catch33 34catch:35 %phi = phi i32 [ %X, %bb ], [ %Y, %cont ]36 %cs = catchswitch within none [label %doit] unwind to caller37 38doit:39 %cl = catchpad within %cs []40 call void @g(i32 %phi)41 unreachable42 43unreachable:44 unreachable45}46 47; CHECK-LABEL: define void @test2(48; CHECK: %X = zext i8 %A to i3249; CHECK: %Y = zext i8 %B to i3250; CHECK: %phi = phi i32 [ %X, %bb ], [ %Y, %cont ]51 52define void @test3(i8 %A, i8 %B) personality ptr @__CxxFrameHandler3 {53bb:54 %X = zext i8 %A to i3255 invoke void @g(i32 0)56 to label %cont57 unwind label %catch58 59cont:60 %Y = zext i8 %B to i3261 invoke void @g(i32 0)62 to label %cont263 unwind label %catch64 65cont2:66 invoke void @g(i32 0)67 to label %unreachable68 unwind label %catch69 70catch:71 %phi = phi i32 [ %X, %bb ], [ %Y, %cont ], [ %Y, %cont2 ]72 %cs = catchswitch within none [label %doit] unwind to caller73 74doit:75 %cl = catchpad within %cs []76 call void @g(i32 %phi)77 unreachable78 79unreachable:80 unreachable81}82 83; CHECK-LABEL: define void @test3(84; CHECK: %X = zext i8 %A to i3285; CHECK: %Y = zext i8 %B to i3286; CHECK: %phi = phi i32 [ %X, %bb ], [ %Y, %cont ], [ %Y, %cont2 ]87 88declare void @foo()89declare token @llvm.experimental.gc.statepoint.p0(i64, i32, ptr, i32, i32, ...)90 91define void @test4(ptr addrspace(1) %obj) gc "statepoint-example" {92bb:93 unreachable94 95unreachable:96 call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(void ()) @foo, i32 0, i32 0, i32 0, i32 0) ["deopt" (i32 0, i32 -1, i32 0, i32 0, i32 0)]97 ret void98}99 100; CHECK-LABEL: define void @test4(101; CHECK: unreachable:102; CHECK: call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(void ()) @foo, i32 0, i32 0, i32 0, i32 0) [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]103; CHECK: ret void104 105 106declare void @g(i32)107