1; RUN: opt < %s -instcombine -S | FileCheck %s
2target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
3
4declare i32 @__gxx_personality_v0(...)
5declare void @__cxa_call_unexpected(i8*)
6declare i64 @llvm.objectsize.i64(i8*, i1) nounwind readonly
7declare i8* @_Znwm(i64)
8
9
10; CHECK-LABEL: @f1(
11define i64 @f1() nounwind uwtable ssp personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
12entry:
13; CHECK: nvoke noalias i8* undef()
14  %call = invoke noalias i8* undef()
15          to label %invoke.cont unwind label %lpad
16
17invoke.cont:
18; CHECK: ret i64 0
19  %0 = tail call i64 @llvm.objectsize.i64(i8* %call, i1 false)
20  ret i64 %0
21
22lpad:
23  %1 = landingpad { i8*, i32 }
24          filter [0 x i8*] zeroinitializer
25  %2 = extractvalue { i8*, i32 } %1, 0
26  tail call void @__cxa_call_unexpected(i8* %2) noreturn nounwind
27  unreachable
28}
29
30; CHECK-LABEL: @f2(
31define i64 @f2() nounwind uwtable ssp personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
32entry:
33; CHECK: nvoke noalias i8* null()
34  %call = invoke noalias i8* null()
35          to label %invoke.cont unwind label %lpad
36
37invoke.cont:
38; CHECK: ret i64 0
39  %0 = tail call i64 @llvm.objectsize.i64(i8* %call, i1 false)
40  ret i64 %0
41
42lpad:
43  %1 = landingpad { i8*, i32 }
44          filter [0 x i8*] zeroinitializer
45  %2 = extractvalue { i8*, i32 } %1, 0
46  tail call void @__cxa_call_unexpected(i8* %2) noreturn nounwind
47  unreachable
48}
49
50; CHECK-LABEL: @f3(
51define void @f3() nounwind uwtable ssp personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
52; CHECK: invoke void @llvm.donothing()
53  %call = invoke noalias i8* @_Znwm(i64 13)
54          to label %invoke.cont unwind label %lpad
55
56invoke.cont:
57  ret void
58
59lpad:
60  %1 = landingpad { i8*, i32 }
61          filter [0 x i8*] zeroinitializer
62  %2 = extractvalue { i8*, i32 } %1, 0
63  tail call void @__cxa_call_unexpected(i8* %2) noreturn nounwind
64  unreachable
65}
66