This repository was archived by the owner on May 28, 2025. It is now read-only.
Commit c1bb0e0
committed
Auto merge of rust-lang#110935 - scottmcm:always-ord, r=Mark-Simulacrum
`inline(always)` for `lt`/`le`/`ge`/`gt` on integers and floats
I happened to notice one of these not getting inlined as part of `Range::next` in <https://rust.godbolt.org/z/4WKWWxj1G>
```rust
bb1: {
StorageLive(_5);
_6 = &mut _4;
StorageLive(_21);
StorageLive(_14);
StorageLive(_15);
_15 = &((*_6).0: usize);
StorageLive(_16);
_16 = &((*_6).1: usize);
_14 = <usize as PartialOrd>::lt(move _15, move _16) -> bb7;
}
```
So since a call for something that's just one instruction is never the right choice, `#[inline(always)]` seems appropriate, like we have it on things like the rotate methods on integers.1 file changed
+8
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1321 | 1321 | | |
1322 | 1322 | | |
1323 | 1323 | | |
1324 | | - | |
| 1324 | + | |
1325 | 1325 | | |
1326 | | - | |
| 1326 | + | |
1327 | 1327 | | |
1328 | | - | |
| 1328 | + | |
1329 | 1329 | | |
1330 | | - | |
| 1330 | + | |
1331 | 1331 | | |
1332 | 1332 | | |
1333 | 1333 | | |
| |||
1359 | 1359 | | |
1360 | 1360 | | |
1361 | 1361 | | |
1362 | | - | |
| 1362 | + | |
1363 | 1363 | | |
1364 | | - | |
| 1364 | + | |
1365 | 1365 | | |
1366 | | - | |
| 1366 | + | |
1367 | 1367 | | |
1368 | | - | |
| 1368 | + | |
1369 | 1369 | | |
1370 | 1370 | | |
1371 | 1371 | | |
| |||
0 commit comments