Open
Description
I tried this code:
pub fn x(a: &mut i32, b: &mut i32) -> bool {
let a_ptr = a as *const i32;
let b_ptr = b as *const i32;
a_ptr == b_ptr
}
I expected to see this happen:
The optimised function should always return false. However it generates a comparison. As seen here https://godbolt.org/z/5YMK1Wc38.
example::x:
cmp rdi, rsi
sete al
ret
rustc --version --verbose
:
rustc 1.69.0-nightly (5e37043d6 2023-01-22)
binary: rustc
commit-hash: 5e37043d63bfe2f3be8fa5a05b07d6c0dad5775d
commit-date: 2023-01-22
host: x86_64-unknown-linux-gnu
release: 1.69.0-nightly
LLVM version: 15.0.7
Compiler returned: 0