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: @f2_no_null_opt( 51define i64 @f2_no_null_opt() nounwind uwtable ssp #0 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { 52entry: 53; CHECK: invoke noalias i8* null() 54 %call = invoke noalias i8* null() 55 to label %invoke.cont unwind label %lpad 56 57invoke.cont: 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) 60 ret i64 %0 61 62lpad: 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 67 unreachable 68} 69attributes #0 = { null_pointer_is_valid } 70 71; CHECK-LABEL: @f3( 72define 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 76 77invoke.cont: 78 ret void 79 80lpad: 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 85 unreachable 86} 87