From a65c0503332b7095cdd5fac19fbc6f9b26dd1786 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Fri, 15 Jan 2021 00:00:00 +0000 Subject: [PATCH] inline: Round word-size cost estimates up --- compiler/rustc_mir/src/transform/inline.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_mir/src/transform/inline.rs b/compiler/rustc_mir/src/transform/inline.rs index 52350c5d07844..07e637b88f9c0 100644 --- a/compiler/rustc_mir/src/transform/inline.rs +++ b/compiler/rustc_mir/src/transform/inline.rs @@ -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; }