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

Recommit: [llvm][ARM][GlobalOpt]Add widen global arrays pass #113289

Merged
merged 15 commits into from
Oct 24, 2024

Conversation

nasherm
Copy link
Contributor

@nasherm nasherm commented Oct 22, 2024

This is a recommit of #107120 . The original PR was approved but failed buildbot. The newly added tests should only be run for compilers that support the ARM target. This has been resolved by adding a config file for these tests.

  • Pass optimizes memcpy's by padding out destinations and sources to a
    full word to make ARM backend generate full word loads instead of
    loading a single byte (ldrb) and/or half word (ldrh). Only pads
    destination when it's a stack allocated constant size array and source
    when it's constant string. Heuristic to decide whether to pad or not
    is very basic and could be improved to allow more examples to be
    padded.
  • Pass works at the midend level

- Pass optimizes memcpy's by padding out destinations and sources to a
  full word to make ARM backend generate full word loads instead of
  loading a single byte (ldrb) and/or half word (ldrh). Only pads
  destination when it's a stack allocated constant size array and source
  when it's constant string. Heuristic to decide whether to pad or not
  is very basic and could be improved to allow more examples to be
  padded.
- Pass works at the midend level

Change-Id: I1c6371f0962e7ad3c166602b800d041ac1cc7b04
Change-Id: I492ea4e5b6f589e5d877eeb6be31f7ab4720be9b
Change-Id: Ic6ed9a549e39020e8c04b38bc21ba8162b4ebfd9
Updating patch so that when attempting to widen
global strings we only check whether the variable is
being called by a memcpy intrinsic.

Change-Id: I088403636c2ed0acc231af77b399b1b95f1abbc2
The case in which copying from a global
source to a global dest wasn't handled and
caused opt to crash. This is now handled and
a new test has been added to check

Change-Id: Ieb0467797fcee888f6e95e68af4dac9c05d70a4d
Change-Id: I029312362f9dd714b2e9bc206cc002883d761b8b
Change-Id: Idc7b14cc785eb88552dd72947eb0df128baa7e90
- Removed handling of global variable destinations. We simply
  don't pad these for now
- Added check that destination array is an array type and added
  test.

Change-Id: Ifc53051952ef69c4af64827402baf7d69cab4824
Change-Id: Iad0539e526fb0fc116217dcbd033f8297fa5ef5f
- Added test showing behaviour of attempting to
  widen non-const globals
- Refactoring

Change-Id: I566214331bf3d889bd1409d3148aa6eab2530ed5
Change-Id: Ie3fe4076113067011fa5bcd19bac765221164198
@nasherm nasherm merged commit e37d736 into llvm:main Oct 24, 2024
9 checks passed
@frobtech frobtech mentioned this pull request Oct 25, 2024
NoumanAmir657 pushed a commit to NoumanAmir657/llvm-project that referenced this pull request Nov 4, 2024
…3289)

This is a recommit of llvm#107120 . The original PR was approved but failed
buildbot. The newly added tests should only be run for compilers that
support the ARM target. This has been resolved by adding a config file
for these tests.

- Pass optimizes memcpy's by padding out destinations and sources to a
  full word to make ARM backend generate full word loads instead of
  loading a single byte (ldrb) and/or half word (ldrh). Only pads
  destination when it's a stack allocated constant size array and source
  when it's constant string. Heuristic to decide whether to pad or not
  is very basic and could be improved to allow more examples to be
  padded.
- Pass works at the midend level
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.

1 participant