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

Implement auto-vectorization #629

Merged
merged 3 commits into from
May 31, 2021
Merged

Implement auto-vectorization #629

merged 3 commits into from
May 31, 2021

Conversation

khyperia
Copy link
Contributor

There are two peephole optimizations included here:

  1. Transforming a chain of OpCompositeInsert into OpCompositeConstruct
  2. Transforming a bunch of scalar ops into a single vector op

I chose to split them up because firstly, it's simpler, the vector ops translation is already overcomplicated, and being able to start the algorithm on a plain OpCompositeConstruct is really nice, and secondly, OpCompositeConstruct works on more than just vectors (arrays and structs too) and that algorithm works on those too.

I also had to implement the "run mem2reg until nothing changes anymore" thingy, because the scalar->vector transformation works on immediate values, not memory values (OpCompositeExtract rather than OpAccessChain), and a couple vector ops were getting missed because they were still behind pointers after a single mem2reg.

@khyperia khyperia requested a review from eddyb May 21, 2021 11:51
@khyperia khyperia merged commit 1046f7c into main May 31, 2021
@khyperia khyperia deleted the peephole-opts branch May 31, 2021 09:22
@khyperia khyperia mentioned this pull request Jun 11, 2021
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