Rollup merge of #81049 - tmiasko:layout-cost, r=oli-obk

inline: Round word-size cost estimates up
This commit is contained in:
Guillaume Gomez 2021-01-15 23:31:01 +01:00 committed by GitHub
commit 1a194d90a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -382,7 +382,7 @@ fn should_inline(&self, callsite: CallSite<'tcx>, callee_body: &Body<'tcx>) -> b
// 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;
}