blob: 6f1329cb4e645b02621be78296860972235b93f7 [file] [log] [blame] [edit]
//@ compile-flags: -Copt-level=1 -Zmir-opt-level=2 -Zub-checks
//@ only-64bit
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
#![crate_type = "lib"]
// The diff shows exactly what is generated by the pass;
// then we check the final `-O1` output for people who want to run them
// without the codegen being too terrible.
// EMIT_MIR alignment_checks.sized_ptr.CheckAlignment.diff
pub unsafe fn sized_ptr(ptr: *const u32) -> u32 {
// CHECK-LABEL: fn sized_ptr(_1: *const u32)
// CHECK: _2 = copy _1 as usize (Transmute);
// CHECK: _3 = BitAnd(copy _2, const 3_usize);
// CHECK: _4 = Eq(copy _3, const 0_usize);
// CHECK: assert(copy _4,
*ptr
}