I decided to make loop unrolling pass for future vectorization optimizations, instead of constant folding pass.
Problem with the last conclusion
It was concluded yesterday that constant folding will be implemented.
But after some research, I found that constant folding can be done arithmetic pass or existing InstCombine pass.
So after some discussion, I decided to make vectorization optimization, which is quite important for performance.
LoopVectorize pass research
I tried to apply existing LoopVectorizePass. But code didn't change after applying the pass.
After some research, I found that LoopVectorizePass gets informations from other existing analyzing passes,
and determine whether applying vectorization is effective.
In my case the pass determined that not applying vectorization is better.
I couldn't find how to modify the analyzing passes to enable vectorization.
LoopUnroll pass research
So, the second option is to apply loop unrolling and vectorize manually.
I tested LoopUnrollPass, which worked well.
Conclusion
After brief meeting with above research results, I've decided to make loop unrolling pass for this sprint.
And I will add some existing loop optimizations for loop unrolling pass and performance.
Summary
I decided to make loop unrolling pass for future vectorization optimizations, instead of constant folding pass.
Problem with the last conclusion
It was concluded yesterday that constant folding will be implemented. But after some research, I found that constant folding can be done arithmetic pass or existing
InstCombine
pass. So after some discussion, I decided to make vectorization optimization, which is quite important for performance.LoopVectorize pass research
I tried to apply existing
LoopVectorizePass
. But code didn't change after applying the pass. After some research, I found that LoopVectorizePass gets informations from other existing analyzing passes, and determine whether applying vectorization is effective. In my case the pass determined that not applying vectorization is better. I couldn't find how to modify the analyzing passes to enable vectorization.LoopUnroll pass research
So, the second option is to apply loop unrolling and vectorize manually. I tested
LoopUnrollPass
, which worked well.Conclusion
After brief meeting with above research results, I've decided to make loop unrolling pass for this sprint. And I will add some existing loop optimizations for loop unrolling pass and performance.