inline: Round word-size cost estimates up

This commit is contained in:
Tomasz Miąsko 2021-01-15 00:00:00 +00:00
parent 18ec4a9a74
commit a65c050333
1 changed files with 1 additions and 1 deletions

View File

@ -382,7 +382,7 @@ impl Inliner<'tcx> {
// Cost of the var is the size in machine-words, if we know
// it.
if let Some(size) = type_size_of(tcx, self.param_env, ty) {
cost += (size / ptr_size) as usize;
cost += ((size + ptr_size - 1) / ptr_size) as usize;
} else {
cost += UNKNOWN_SIZE_COST;
}