Skip to content
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

AddValidation: handle Call terminators into blocks that have multiple incoming edges #43748

Merged
merged 1 commit into from
Aug 11, 2017

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Aug 8, 2017

The old code was just wrong: It would add validation on paths that don't even come from the call, and it would add multiple validations if multiple calls end return to the same block.

@rust-highfive
Copy link
Collaborator

r? @eddyb

(rust_highfive has picked a reviewer for you, use r? to override)

@RalfJung
Copy link
Member Author

RalfJung commented Aug 8, 2017

Cc @nikomatsakis

@arielb1
Copy link
Contributor

arielb1 commented Aug 9, 2017

The ElaborateDrops pass has an AddCallGuards pass before it, which breaks edges after calls and would allow your old code to work. If you prefer, you can just add another AddCallGuards pass before your Validate pass.

@@ -945,11 +945,11 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
passes.push_pass(MIR_OPTIMIZED, mir::transform::add_call_guards::AddCallGuards);
passes.push_pass(MIR_OPTIMIZED, mir::transform::elaborate_drops::ElaborateDrops);
passes.push_pass(MIR_OPTIMIZED, mir::transform::no_landing_pads::NoLandingPads);
passes.push_pass(MIR_OPTIMIZED, mir::transform::simplify::SimplifyCfg::new("elaborate-drops"));
// No lifetime analysis based on borrowing can be done from here on out.

// AddValidation needs to run after ElaborateDrops and before EraseRegions.
Copy link
Contributor

@arielb1 arielb1 Aug 9, 2017

Choose a reason for hiding this comment

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

I think you can replace this patch with a

passes.push_pass(MIR_OPTIMIZED, mir::transform::add_call_guards::AddCallGuards);

Here

@RalfJung
Copy link
Member Author

RalfJung commented Aug 9, 2017

Thanks for this hint! I re-did the PR based on that.

@arielb1
Copy link
Contributor

arielb1 commented Aug 9, 2017

@bors r+

@bors
Copy link
Contributor

bors commented Aug 9, 2017

📌 Commit 718a8d1 has been approved by arielb1

@aidanhs aidanhs added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Aug 10, 2017
@bors
Copy link
Contributor

bors commented Aug 11, 2017

⌛ Testing commit 718a8d1 with merge 38bdbb7...

bors added a commit that referenced this pull request Aug 11, 2017
AddValidation: handle Call terminators into blocks that have multiple incoming edges

The old code was just wrong: It would add validation on paths that don't even come from the call, and it would add multiple validations if multiple calls end return to the same block.
@bors
Copy link
Contributor

bors commented Aug 11, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: arielb1
Pushing 38bdbb7 to master...

@bors bors merged commit 718a8d1 into rust-lang:master Aug 11, 2017
This was referenced Aug 11, 2017
@RalfJung RalfJung deleted the mir-validate2 branch July 10, 2018 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants