Commit a451b2a
committed
Auto merge of rust-lang#126852 - scottmcm:more-checked-math-tweaks, r=Amanieu
Also get `add nuw` from `uN::checked_add`
When I was doing this for `checked_{sub,shl,shr}`, it was mentioned rust-lang#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 itself1 file changed
+13
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
454 | 454 | | |
455 | 455 | | |
456 | 456 | | |
457 | | - | |
458 | | - | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
459 | 470 | | |
460 | 471 | | |
461 | 472 | | |
| |||
0 commit comments