1 ; RUN: opt < %s -instcombine -S | FileCheck %s
2 target 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"
4 declare i32 @__gxx_personality_v0(...)
5 declare void @__cxa_call_unexpected(i8*)
6 declare i64 @llvm.objectsize.i64(i8*, i1) nounwind readonly
7 declare i8* @_Znwm(i64)
11 define i64 @f1() nounwind uwtable ssp personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
13 ; CHECK: nvoke noalias i8* undef()
14 %call = invoke noalias i8* undef()
15 to label %invoke.cont unwind label %lpad
19 %0 = tail call i64 @llvm.objectsize.i64(i8* %call, i1 false)
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
31 define i64 @f2() nounwind uwtable ssp personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
33 ; CHECK: nvoke noalias i8* null()
34 %call = invoke noalias i8* null()
35 to label %invoke.cont unwind label %lpad
39 %0 = tail call i64 @llvm.objectsize.i64(i8* %call, i1 false)
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
50 ; CHECK-LABEL: @f2_no_null_opt(
51 define i64 @f2_no_null_opt() nounwind uwtable ssp #0 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
53 ; CHECK: invoke noalias i8* null()
54 %call = invoke noalias i8* null()
55 to label %invoke.cont unwind label %lpad
58 ; CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* %call, i1 false, i1 false, i1 false)
59 %0 = tail call i64 @llvm.objectsize.i64(i8* %call, i1 false)
63 %1 = landingpad { i8*, i32 }
64 filter [0 x i8*] zeroinitializer
65 %2 = extractvalue { i8*, i32 } %1, 0
66 tail call void @__cxa_call_unexpected(i8* %2) noreturn nounwind
69 attributes #0 = { "null-pointer-is-valid"="true" }
72 define void @f3() nounwind uwtable ssp personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
73 ; CHECK: invoke void @llvm.donothing()
74 %call = invoke noalias i8* @_Znwm(i64 13)
75 to label %invoke.cont unwind label %lpad
81 %1 = landingpad { i8*, i32 }
82 filter [0 x i8*] zeroinitializer
83 %2 = extractvalue { i8*, i32 } %1, 0
84 tail call void @__cxa_call_unexpected(i8* %2) noreturn nounwind