Skip to content

Commit 05742ff

Browse files
committed
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.
1 parent 960f604 commit 05742ff

File tree

1 file changed

+3
-13
lines changed
  • src/librustc_mir/dataflow

1 file changed

+3
-13
lines changed

src/librustc_mir/dataflow/mod.rs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,9 @@ impl<'a, 'tcx, D> DataflowAnalysis<'a, 'tcx, D> where D: BitDenotation
736736
let bits_per_block = denotation.bits_per_block();
737737
let usize_bits = mem::size_of::<usize>() * 8;
738738
let words_per_block = (bits_per_block + usize_bits - 1) / usize_bits;
739-
let num_overall = Self::num_bits_overall(mir, bits_per_block);
739+
let bits_per_block_rounded_up = words_per_block * usize_bits; // a multiple of word size
740+
let num_blocks = mir.basic_blocks().len();
741+
let num_overall = num_blocks * bits_per_block_rounded_up;
740742

741743
let zeroes = Bits::new(IdxSetBuf::new_empty(num_overall));
742744
let on_entry = Bits::new(if D::bottom_value() {
@@ -774,18 +776,6 @@ impl<'a, 'tcx, D> DataflowAnalysis<'a, 'tcx, D> where D: BitDenotation
774776
}
775777
}
776778
}
777-
778-
fn num_bits_overall(mir: &Mir, bits_per_block: usize) -> usize {
779-
let usize_bits = mem::size_of::<usize>() * 8;
780-
let words_per_block = (bits_per_block + usize_bits - 1) / usize_bits;
781-
782-
// (now rounded up to multiple of word size)
783-
let bits_per_block = words_per_block * usize_bits;
784-
785-
let num_blocks = mir.basic_blocks().len();
786-
let num_overall = num_blocks * bits_per_block;
787-
num_overall
788-
}
789779
}
790780

791781
impl<'a, 'tcx: 'a, D> DataflowAnalysis<'a, 'tcx, D> where D: BitDenotation

0 commit comments

Comments
 (0)