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

[CodeGen][ShrinkWrap] Clarify StackAddressUsedBlockInfo meaning #80679

Conversation

enoskova-sc
Copy link
Contributor

No description provided.

Copy link

github-actions bot commented Feb 5, 2024

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be
notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write
permissions for the repository. In which case you can instead tag reviewers by
name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review
by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate
is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@enoskova-sc
Copy link
Contributor Author

@MatzeB, please, take a look.

@enoskova-sc
Copy link
Contributor Author

@qcolombet, may be you have any comments?

/// the block itself.
/// Is `true` for the block numbers where we cannot guarantee that there will
/// be no access to the stack or computation of stack-relative addresses on
/// any CFG path including the block itself.
Copy link
Collaborator

Choose a reason for hiding this comment

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

The comment is indeed out of date.
Is true => there may be a stack access or computation of ... (i.e., just drop the no from the original comment)
Is false => no stack access or computation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree that after my changes comment looks too complicated.
Nevertheless if I simply drop no from the original comment, we'll get

  /// Is `true` for block numbers where we can guarantee stack access
  /// or computation of stack-relative addresses on any CFG path including
  /// the block itself.

which means, what we are sure that there will be access to the stack or computation of stack-relative addresses. But really we only assume it.
May be it will be better to write

  /// Is `true` for block numbers where we assume possible stack access
  /// or computation of stack-relative addresses on any CFG path including
  /// the block itself.

Copy link
Collaborator

@qcolombet qcolombet Feb 15, 2024

Choose a reason for hiding this comment

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

Yes, that’s why I said “may”.
And call out the false case. Essentially we can have false positive, I.e., we are conservative to remain correct.

Feel free to rephrase!

@@ -948,6 +948,9 @@ bool ShrinkWrap::runOnMachineFunction(MachineFunction &MF) {

bool Changed = false;

// Initially, conservatively assume that stack addresses can be used in each
// basic block and change the state only for those basic blocks for which we
// were able to prove the opposite.
Copy link
Collaborator

Choose a reason for hiding this comment

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

That part looks good.

@enoskova-sc enoskova-sc force-pushed the users/enoskova-sc/update-shrink-wrap-description branch from 47fddd4 to dd2b04d Compare February 15, 2024 14:42
Copy link

github-actions bot commented Feb 15, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@enoskova-sc enoskova-sc force-pushed the users/enoskova-sc/update-shrink-wrap-description branch from dd2b04d to a0b8ba8 Compare February 15, 2024 15:30
@enoskova-sc
Copy link
Contributor Author

@qcolombet, is it now good?

@enoskova-sc
Copy link
Contributor Author

@qcolombet, do you have any more comments?

@enoskova-sc
Copy link
Contributor Author

@fhahn, may be you can comment on this?

@enoskova-sc
Copy link
Contributor Author

@sushgokh, may be you can comment on this?

Copy link
Collaborator

@qcolombet qcolombet left a comment

Choose a reason for hiding this comment

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

Apologies for the delays, I missed the notifications for the updates.

@asi-sc asi-sc merged commit 4dd103e into llvm:main Apr 3, 2024
4 checks passed
Copy link

github-actions bot commented Apr 3, 2024

@enoskova-sc Congratulations on having your first Pull Request (PR) merged into the LLVM Project!

Your changes will be combined with recent changes from other authors, then tested
by our build bots. If there is a problem with a build, you may receive a report in an email or a comment on this PR.

Please check whether problems have been caused by your change specifically, as
the builds can include changes from many authors. It is not uncommon for your
change to be included in a build that fails due to someone else's changes, or
infrastructure issues.

How to do this, and the rest of the post-merge process, is covered in detail here.

If your change does cause a problem, it may be reverted, or you can revert it yourself.
This is a normal part of LLVM development. You can fix your changes and open a new PR to merge them again.

If you don't get any reports, no action is required from you. Your changes are working as expected, well done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants