secret
Last active

  • Download Gist
gistfile1.rs
Rust
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#[crate_type="lib"];
 
pub struct Foo {
x: uint,
y: uint
}
 
#[inline(never)]
#[no_mangle]
pub fn foo(f: Foo) -> Foo {
f
}
 
#[no_mangle]
pub fn bar(f: Foo) -> Foo {
foo(f)
}
gistfile2.ll
LLVM
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
; Function Attrs: noinline nounwind uwtable
define void @foo(%struct.Foo* noalias nocapture sret, { i64, %tydesc*, i8*, i8*, i8 }* nocapture readnone, %struct.Foo* nocapture readonly) unnamed_addr #1 {
"function top level":
%3 = bitcast %struct.Foo* %2 to i8*
%4 = bitcast %struct.Foo* %0 to i8*
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %4, i8* %3, i64 16, i32 8, i1 false)
ret void
}
 
; Function Attrs: nounwind uwtable
define void @bar(%struct.Foo* noalias nocapture sret, { i64, %tydesc*, i8*, i8*, i8 }* nocapture readnone, %struct.Foo* nocapture readonly) unnamed_addr #2 {
"function top level":
%__self = alloca %struct.Foo, align 8
%3 = bitcast %struct.Foo* %2 to i8*
%4 = bitcast %struct.Foo* %__self to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %4, i8* %3, i64 16, i32 8, i1 false)
call void @foo(%struct.Foo* sret %0, { i64, %tydesc*, i8*, i8*, i8 }* undef, %struct.Foo* %__self)
ret void
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.