Closed
Description
#[naked]
unsafe extern "C" fn test(a: *const c_void, b: *mut c_void) {
unreachable!();
}
results in
; Function Attrs: naked uwtable
define internal void @_ZN8rust_out4test17h785f8ce455c67198E(i8*, i8*) unnamed_addr #0 !dbg !30 {
entry-block:
%a = alloca i8*
%b = alloca i8*
%const = alloca %str_slice
%2 = alloca { %str_slice, i32 }*
store i8* %0, i8** %a
call void @llvm.dbg.declare(metadata i8** %a, metadata !93, metadata !94), !dbg !95
store i8* %1, i8** %b
call void @llvm.dbg.declare(metadata i8** %b, metadata !96, metadata !94), !dbg !95
%3 = bitcast %str_slice* %const to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %3, i8* bitcast (%str_slice* @const7081 to i8*), i64 16, i32 8, i1 false)
%4 = getelementptr inbounds %str_slice, %str_slice* %const, i32 0, i32 0
%5 = load i8*, i8** %4
%6 = getelementptr inbounds %str_slice, %str_slice* %const, i32 0, i32 1
%7 = load i64, i64* %6
store { %str_slice, i32 }* bitcast ({ %str_slice, i32, [4 x i8] }* @_ZN8rust_out4test10_FILE_LINE17h08e1dfa3dee60bceE to { %str_slice, i32 }*), { %str_slice, i32 }** %2, !dbg !97
%8 = load { %str_slice, i32 }*, { %str_slice, i32 }** %2, !dbg !97, !nonnull !37
call void @_ZN3std9panicking11begin_panic17h4ebf9fe884b2415fE(i8* noalias nonnull readonly %5, i64 %7, { %str_slice, i32 }* noalias readonly dereferenceable(24) %8), !dbg !102
unreachable, !dbg !102
}
Most of these instructions should not be present, and result in undesired codegen prior to any user code (i.e. assembly).