diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2017-10-24 11:57:22 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2017-10-31 12:41:38 -0400 |
| commit | ea03a43fe67f06a13654dc7ddf89e62ba9dbe2e9 (patch) | |
| tree | 0459054bf5c7006cde393e797397c1366e3f0c86 /src | |
| parent | bd2511652fec706c306a3c11742e69756a4d0fb1 (diff) | |
| download | rust-ea03a43fe67f06a13654dc7ddf89e62ba9dbe2e9.tar.gz rust-ea03a43fe67f06a13654dc7ddf89e62ba9dbe2e9.zip | |
introduce `apply` helper that applies a DefUse set to live bits
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_mir/util/liveness.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/librustc_mir/util/liveness.rs b/src/librustc_mir/util/liveness.rs index d0a37e8a224..d3a10225cdc 100644 --- a/src/librustc_mir/util/liveness.rs +++ b/src/librustc_mir/util/liveness.rs @@ -54,6 +54,10 @@ struct DefsUses { } impl DefsUses { + fn apply(&self, bits: &mut LocalSet) -> bool { + bits.subtract(&self.defs) | bits.union(&self.uses) + } + fn add_def(&mut self, index: Local) { // If it was used already in the block, remove that use // now that we found a definition. @@ -194,8 +198,9 @@ pub fn liveness_of_locals<'tcx>(mir: &Mir<'tcx>) -> LivenessResult { // in = use ∪ (out - def) ins[b].clone_from(&outs[b]); - ins[b].subtract(&def_use[b].defs); - ins[b].union(&def_use[b].uses); + + // FIXME use the return value to detect if we have changed things + def_use[b].apply(&mut ins[b]); } if ins_ == ins && outs_ == outs { |
