about summary refs log tree commit diff
path: root/compiler/rustc_lint/src/reference_casting.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-05-05 01:06:22 +0000
committerbors <bors@rust-lang.org>2024-05-05 01:06:22 +0000
commit02f7806ecd641d67c8f046b073323c7e176ee6d2 (patch)
tree69ae893721e115b094c514322858afe21ec98c30 /compiler/rustc_lint/src/reference_casting.rs
parente82c861d7e5ecd766cb0dab0bf622445dec999dc (diff)
parentc04b95512dd5509129850d346c9847191d329687 (diff)
downloadrust-02f7806ecd641d67c8f046b073323c7e176ee6d2.tar.gz
rust-02f7806ecd641d67c8f046b073323c7e176ee6d2.zip
Auto merge of #124606 - scottmcm:less-expect, r=cjgillot
Stop `llvm.expect`ing assert terminators

We're putting `llvm.expect` calls before the <https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/enum.TerminatorKind.html#variant.Assert> terminators.

But we don't need them.  One of the arms is always to a panic function that's marked `#[cold]`, which is `cold` <https://llvm.org/docs/LangRef.html#function-attributes> in LLVM, which

> When computing edge weights, basic blocks post-dominated by a cold function call are also considered to be cold; and, thus, given low weight.

So even without us emitting the extra intrinsic call, LLVM knows what to expect for the `br`.  Thus we can save the (small) effort of emitting it and then LLVM optimizing it out.

r? compiler
Diffstat (limited to 'compiler/rustc_lint/src/reference_casting.rs')
0 files changed, 0 insertions, 0 deletions