diff options
| author | bors <bors@rust-lang.org> | 2024-06-21 02:06:27 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-06-21 02:06:27 +0000 |
| commit | 7a08f84627ff3035de4d66ff3209e5fc93165dcb (patch) | |
| tree | 07032b0a88e108d725287f5f826bcff1e6091ec1 /tests/codegen | |
| parent | a9c8887c7d548abc6c3e87f7d6fa02a0e95880bd (diff) | |
| parent | eac6b2910a5513a3d395814aa20739cabd388723 (diff) | |
| download | rust-7a08f84627ff3035de4d66ff3209e5fc93165dcb.tar.gz rust-7a08f84627ff3035de4d66ff3209e5fc93165dcb.zip | |
Auto merge of #126578 - scottmcm:inlining-bonuses-too, r=davidtwco
Account for things that optimize out in inlining costs This updates the MIR inlining `CostChecker` to have both bonuses and penalties, rather than just penalties. That lets us add bonuses for some things where we want to encourage inlining without risking wrapping into a gigantic cost. For example, `switchInt(const …)` we give an inlining bonus because codegen will actually eliminate the branch (and associated dead blocks) once it's monomorphized, so measuring both sides of the branch gives an unrealistically-high cost to it. Similarly, an `unreachable` terminator gets a small bonus, because whatever branch leads there doesn't actually exist post-codegen.
Diffstat (limited to 'tests/codegen')
| -rw-r--r-- | tests/codegen/issues/issue-112509-slice-get-andthen-get.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/codegen/issues/issue-112509-slice-get-andthen-get.rs b/tests/codegen/issues/issue-112509-slice-get-andthen-get.rs index ae02c3fb79e..aee2edd8dfa 100644 --- a/tests/codegen/issues/issue-112509-slice-get-andthen-get.rs +++ b/tests/codegen/issues/issue-112509-slice-get-andthen-get.rs @@ -3,8 +3,12 @@ // CHECK-LABEL: @write_u8_variant_a // CHECK-NEXT: {{.*}}: -// CHECK-NEXT: getelementptr // CHECK-NEXT: icmp ugt +// CHECK-NEXT: getelementptr +// CHECK-NEXT: select i1 {{.+}} null +// CHECK-NEXT: insertvalue +// CHECK-NEXT: insertvalue +// CHECK-NEXT: ret #[no_mangle] pub fn write_u8_variant_a(bytes: &mut [u8], buf: u8, offset: usize) -> Option<&mut [u8]> { let buf = buf.to_le_bytes(); |
