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

Start block is not allowed to have basic block predecessors #88968

Merged
merged 4 commits into from
Sep 19, 2021

Conversation

tmiasko
Copy link
Contributor

@tmiasko tmiasko commented Sep 15, 2021

  • The MIR validator is extended to detect potential violations.
  • The start block has no predecessors after building MIR, so no changes are required there.
  • The SimplifyCfg could previously violate this requirement when collapsing goto chains, so transformation is disabled for the start block, which also substantially simplifies the implementation.
  • The LLVM function entry block also must not have basic block predecessors. Previously, to ensure that code generation had to perform necessary adjustments. This now became unnecessary.

The motivation behind the change is to align with analogous requirement in LLVM, and to avoid potential latent bugs like the one reported in #88043.

@rust-highfive
Copy link
Collaborator

r? @davidtwco

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 15, 2021
Copy link
Member

@davidtwco davidtwco left a comment

Choose a reason for hiding this comment

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

LGTM!

@davidtwco
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Sep 15, 2021

📌 Commit a923975d2cf29c8a73da2334e35f12338367cd9a has been approved by davidtwco

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 15, 2021
@Mark-Simulacrum
Copy link
Member

@bors rollup=never -- codegen/MIR changes, may be perf sensitive

@bors
Copy link
Contributor

bors commented Sep 18, 2021

⌛ Testing commit a923975d2cf29c8a73da2334e35f12338367cd9a with merge 453ff06ca7e1d2f4764f6e383cdea63bd24a3f46...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Sep 18, 2021

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 18, 2021
If any block on a goto chain has more than one predecessor, then the new
start block would have basic block predecessors.

Skip the transformation for the start block altogether, to avoid
violating the new invariant that the start block does not have any basic
block predecessors.
The start block is guaranteed not to have any basic block predecessors.
@tmiasko tmiasko force-pushed the start-block-no-predecessors branch from a923975 to f1f1c8f Compare September 18, 2021 06:09
@tmiasko
Copy link
Contributor Author

tmiasko commented Sep 18, 2021

Rebased and reblessed mir opt coverage tests.

@jackh726
Copy link
Member

@bors r=davidtwco

@bors
Copy link
Contributor

bors commented Sep 18, 2021

📌 Commit f1f1c8f has been approved by davidtwco

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 18, 2021
@bors
Copy link
Contributor

bors commented Sep 19, 2021

⌛ Testing commit f1f1c8f with merge 10967a1...

@bors
Copy link
Contributor

bors commented Sep 19, 2021

☀️ Test successful - checks-actions
Approved by: davidtwco
Pushing 10967a1 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 19, 2021
@bors bors merged commit 10967a1 into rust-lang:master Sep 19, 2021
@rustbot rustbot added this to the 1.57.0 milestone Sep 19, 2021
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (10967a1): comparison url.

Summary: This benchmark run did not return any relevant changes.

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

@tmiasko tmiasko deleted the start-block-no-predecessors branch September 19, 2021 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.

9 participants