Skip to content

Commit

Permalink
Auto merge of #126852 - scottmcm:more-checked-math-tweaks, r=Amanieu
Browse files Browse the repository at this point in the history
Also get `add nuw` from `uN::checked_add`

When I was doing this for `checked_{sub,shl,shr}`, it was mentioned rust-lang/rust#124114 (comment) that it'd be worth trying for `checked_add` too.

It makes a particularly-big difference for `x.checked_add(C)`, as doing this means that LLVM removes the intrinsic and does it as a normal `x <= MAX - C` instead.

cc `@DianQK` who had commented about `checked_add` related to rust-lang/hashbrown#509 before

cc llvm/llvm-project#80637 for how LLVM is unlikely to do this itself
  • Loading branch information
bors committed Jun 25, 2024
2 parents 902c9f9 + b6e7c4b commit cebb1e2
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit cebb1e2

Please sign in to comment.