Skip to content

Analyse storage liveness and preserve it during generator transformation #44480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 14, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix a bug where StorageIgnored had an incorrect buffer length
  • Loading branch information
Zoxc committed Sep 13, 2017
commit 0e8e6592f6650f975fc39bfcdef53ce474c1e7a9
4 changes: 2 additions & 2 deletions src/librustc_mir/transform/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ fn locals_live_across_suspend_points<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
dataflow::do_dataflow(tcx, mir, node_id, &[], &dead_unwinds, analysis,
|bd, p| &bd.mir().local_decls[p]);

let mut ignored = StorageIgnored(IdxSetBuf::new_filled(mir.basic_blocks().len()));
let mut ignored = StorageIgnored(IdxSetBuf::new_filled(mir.local_decls.len()));
ignored.visit_mir(mir);

let mut set = liveness::LocalSet::new_empty(mir.local_decls.len());
Expand All @@ -365,7 +365,7 @@ fn locals_live_across_suspend_points<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,

Copy link
Contributor

@arielb1 arielb1 Sep 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... and also have a let live_locals = storage_liveness; here. It's free to use better names.

let mut live_locals = storage_liveness;

// Mark locals without storage statements as always live
// Mark locals without storage statements as always having live storage
live_locals.union(&ignored.0);

// Locals live are live at this point only if they are used across suspension points
Expand Down