about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-08-07 01:19:34 +0200
committerGitHub <noreply@github.com>2022-08-07 01:19:34 +0200
commitf0ff31fa09a144b1c24099e7b93be87522200caf (patch)
treeb08e89a6fe55744e5b5046ee9ac2bdd8ce90730b /compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
parent1a96f31f763142942adf7f15421b2d59494c2af4 (diff)
parentc195f7c0a432d1d77aed3c490509895add77f93f (diff)
downloadrust-f0ff31fa09a144b1c24099e7b93be87522200caf.tar.gz
rust-f0ff31fa09a144b1c24099e7b93be87522200caf.zip
Rollup merge of #100169 - WaffleLapkin:optimize_is_aligned_to, r=workingjubilee
Optimize `pointer::as_aligned_to`

This PR replaces `addr % align` with `addr & align - 1`, which is correct due to `align` being a power of two.

Here is a proof that this makes things better: [[godbolt]](https://godbolt.org/z/Wbq3hx6YG).

This PR also removes `assume(align != 0)`, with the new impl it does not improve anything anymore ([[godbolt]](https://rust.godbolt.org/z/zcnrG4777), [[original concern]](https://github.com/rust-lang/rust/pull/95643#discussion_r843326903)).
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp')
0 files changed, 0 insertions, 0 deletions