Skip to content

Commit 1a194d9

Browse files
Rollup merge of #81049 - tmiasko:layout-cost, r=oli-obk
inline: Round word-size cost estimates up
2 parents 97b736c + a65c050 commit 1a194d9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: compiler/rustc_mir/src/transform/inline.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ impl Inliner<'tcx> {
382382
// Cost of the var is the size in machine-words, if we know
383383
// it.
384384
if let Some(size) = type_size_of(tcx, self.param_env, ty) {
385-
cost += (size / ptr_size) as usize;
385+
cost += ((size + ptr_size - 1) / ptr_size) as usize;
386386
} else {
387387
cost += UNKNOWN_SIZE_COST;
388388
}

0 commit comments

Comments
 (0)