about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <nnethercote@mozilla.com>2018-07-13 10:34:21 +1000
committerNicholas Nethercote <nnethercote@mozilla.com>2018-07-13 10:34:21 +1000
commit05742ffb432adb0278bcb7262251cec9657d4067 (patch)
treeb7f9832a41846f41d4e20ee95c947398ed7a9d0d
parent960f6046c6d367a48f405dd5c76cc303497edfc5 (diff)
downloadrust-05742ffb432adb0278bcb7262251cec9657d4067.tar.gz
rust-05742ffb432adb0278bcb7262251cec9657d4067.zip
Inline and remove `DataflowAnalysis::num_bits_overall()`.
It has a single callsite, and duplicates some code from that callsite.
The code is more concise and clearer this way.
-rw-r--r--src/librustc_mir/dataflow/mod.rs16
1 files changed, 3 insertions, 13 deletions
diff --git a/src/librustc_mir/dataflow/mod.rs b/src/librustc_mir/dataflow/mod.rs
index e3b67b0a003..e59236c5168 100644
--- a/src/librustc_mir/dataflow/mod.rs
+++ b/src/librustc_mir/dataflow/mod.rs
@@ -736,7 +736,9 @@ impl<'a, 'tcx, D> DataflowAnalysis<'a, 'tcx, D> where D: BitDenotation
         let bits_per_block = denotation.bits_per_block();
         let usize_bits = mem::size_of::<usize>() * 8;
         let words_per_block = (bits_per_block + usize_bits - 1) / usize_bits;
-        let num_overall = Self::num_bits_overall(mir, bits_per_block);
+        let bits_per_block_rounded_up = words_per_block * usize_bits; // a multiple of word size
+        let num_blocks = mir.basic_blocks().len();
+        let num_overall = num_blocks * bits_per_block_rounded_up;
 
         let zeroes = Bits::new(IdxSetBuf::new_empty(num_overall));
         let on_entry = Bits::new(if D::bottom_value() {
@@ -774,18 +776,6 @@ impl<'a, 'tcx, D> DataflowAnalysis<'a, 'tcx, D> where D: BitDenotation
             }
         }
     }
-
-    fn num_bits_overall(mir: &Mir, bits_per_block: usize) -> usize {
-        let usize_bits = mem::size_of::<usize>() * 8;
-        let words_per_block = (bits_per_block + usize_bits - 1) / usize_bits;
-
-        // (now rounded up to multiple of word size)
-        let bits_per_block = words_per_block * usize_bits;
-
-        let num_blocks = mir.basic_blocks().len();
-        let num_overall = num_blocks * bits_per_block;
-        num_overall
-    }
 }
 
 impl<'a, 'tcx: 'a, D> DataflowAnalysis<'a, 'tcx, D> where D: BitDenotation