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

consider fncall param aligns when calculating access size #596

Merged
merged 2 commits into from Nov 30, 2020

Conversation

aqjune
Copy link
Member

@aqjune aqjune commented Nov 27, 2020

This PR resolves #480 .

@aqjune aqjune marked this pull request as draft November 27, 2020 07:13
@aqjune aqjune marked this pull request as ready for review November 27, 2020 19:46
@aqjune
Copy link
Member Author

aqjune commented Nov 27, 2020

No regression found from LLVM unit tests

if (!arg.first->getType().isPtrType())
continue;

if (arg.second.has(ParamAttrs::Dereferenceable)) {
Copy link
Member

Choose a reason for hiding this comment

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

what if the function takes 2 pointers, one with dereferenceable/align and one without? Then min access needs to be 1, right?

Copy link
Member Author

@aqjune aqjune Nov 27, 2020

Choose a reason for hiding this comment

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

I think in the case min access can be larger than 1, but due to a non-trivial reason.
I'll describe why I think so.

call f(dereferenceable(4) align 4 %p, %q) is equivalent to a dummy load followed by the call:

load i32 %p, align 4 // a dummy load
call f(%p, %q)

The dummy load contributes to the min access size, as a real load instruction does.

However, for the call f(%p, %q), I think it shouldn't set the min access size to 1; otherwise it deoptimizes too many things.
I think we can assume that a call updates the memory with min access size granularity.

Assuming that this dummy load idea makes sense, I think pointer arguments without dereferenceable shouldn't update the min access size.

@nunoplopes nunoplopes merged commit 1a84981 into AliveToolkit:master Nov 30, 2020
@aqjune aqjune deleted the alignfunc branch February 16, 2023 02:19
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.

Take advantage of align function/argument attributes
2 participants