Hi All,
Please find attached the patch for Loop Interchange Pass for llvm. Initial RFC and design was submitted at http://reviews.llvm.org/D7432 .
This pass is disabled by default.
To give a brief intorduction it consists of 3 stages-
- LoopInterchangeLegality : Checks the legality of loop interchange based on distance/direction vector.
- LoopInterchangeProfitability: A very basic heuristic has been added to check for profitibility. This will evolve over time.
- LoopInterchangeTransform : Which does the actual transform.
Current Limitation:
- Only handles leve 2 loops for now. Will extend it going forward to support any level of loops as James had suggested during RFC.
- Triangular loops are not yet supported.
As Hal had suggested during RFC i went through TSVC Benchmark. Unfortunetly i didnt get time to run it but i went through the test case for loop interchange. One of the test cases s231() which was not being vectorized previously now gets vectorized. Added a similar test case in this patch.
This patch seems to be working fine and producing correct result (i.e. interchanging doesn't change the o/p of the program) to best of my knowledge.
Wanted some comments on how to go about writing test cases for this transform? Please let me know your inputs of this.
Also is it ok to do further development on trunk once this patch is finalized?
Thanks and Regards
Karthik Bhat
You've un-improved this comment; please change it back.