Logo
Explore Help
Register Sign In
rust-lang/rust
1
0
Fork 0
You've already forked rust
Code Issues Pull Requests Actions 1 Packages Projects Releases Wiki Activity
Files
1f11d841b5748133c2d51da0001fc88bc6b51e78
rust/tests/codegen/coercions.rs

20 lines
372 B
Rust
Raw Normal View History

Avoid deref/ref cycles for no-op coercions between unsafe pointers Unlike coercing from reference to unsafe pointer, coercing between two unsafe pointers doesn't need an AutoDerefRef, because there is no region that regionck would need to know about. In unoptimized libcore, this reduces the number of "auto_deref" allocas from 174 to 4.
2015-06-16 10:53:06 +02:00
// compile-flags: -C no-prepopulate-passes
Avoid loading the whole gdb debug scripts section. This is so LLVM isn't forced to load every byte of it. Also sets the alignment of the load. Adds a test for the debug script section.
2015-09-15 16:22:16 -05:00
#![crate_type = "lib"]
Avoid deref/ref cycles for no-op coercions between unsafe pointers Unlike coercing from reference to unsafe pointer, coercing between two unsafe pointers doesn't need an AutoDerefRef, because there is no region that regionck would need to know about. In unoptimized libcore, this reduces the number of "auto_deref" allocas from 174 to 4.
2015-06-16 10:53:06 +02:00
static X: i32 = 5;
// CHECK-LABEL: @raw_ptr_to_raw_ptr_noop
// CHECK-NOT: alloca
#[no_mangle]
pub fn raw_ptr_to_raw_ptr_noop() -> *const i32{
&X as *const i32
}
// CHECK-LABEL: @reference_to_raw_ptr_noop
// CHECK-NOT: alloca
#[no_mangle]
pub fn reference_to_raw_ptr_noop() -> *const i32 {
&X
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.6 Page: 1389ms Template: 3ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API