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

[SVE] Fix incorrect offset calculation when rewriting an instruction's frame index. #70315

Merged
merged 2 commits into from
Oct 27, 2023

Conversation

paulwalker-arm
Copy link
Collaborator

@paulwalker-arm paulwalker-arm commented Oct 26, 2023

When partially packing an offset into an SVE load/store instruction we are incorrectly calculating the remainder.

Copy link
Contributor

@david-arm david-arm left a comment

Choose a reason for hiding this comment

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

LGTM!


name: fp_relative_that_is_not_a_multiple_of_VLx16
stack:
- { id: 0, stack-id: scalable-vector, size: 50, alignment: 2 }
Copy link
Collaborator

Choose a reason for hiding this comment

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

The test can be simplified to have a single object, rather than multiple. Additionally, the extending part of the load makes the test even more confusing because mul vl means mul vscale x 2 x 4 bytes instead of mul vscale x 4 x 4 bytes.

Maybe you can simplify this test to:

stack:
  - { id: 0, stack-id: scalable-vector, size: 156, alignment: 1 }
  - { id: 1, stack-id: default, type: variable-sized, alignment: 1 }
...
   renamable $z0 = LD1W_IMM killed renamable $p0, %stack.0, 0

where 156 is calculated as (8 x 16) + (14 x 2) bytes. I checked that this still exposes the original issue this patch intends to fix.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks @sdesmalen-arm , I've simplified the test case as suggested.

@paulwalker-arm paulwalker-arm merged commit 7c90be2 into llvm:main Oct 27, 2023
2 checks passed
tru pushed a commit that referenced this pull request Oct 30, 2023
…s frame index. (#70315)

When partially packing an offset into an SVE load/store instruction we
are incorrectly calculating the remainder.

(cherry picked from commit 7c90be2)
@paulwalker-arm paulwalker-arm deleted the sve-stack-corruption branch November 2, 2023 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants