Thanks Hal, Philip and Adam for reviewing this RFC.
Based on suggestion I have made below changes.
Code change available at: http://reviews.llvm.org/D9151
- Using LAA(Loop Access Analysis) for versioning feasibility & memcheck.
As the part of feasibility analysis started using LAA.
Earlier memcheck creation was implemented under Loop Versioning, now using
LAA for this.
- Improved benefit analysis.
Introduced few checks to ensure the benefit of loop versioning.
- Checking number of possible invariant promotion vs total instructions of loop.
If this goes beyond certain threshold then only do loop versioning.
Kept this threshold as a hard value as 25%(total instruction of loop), also
provided option to control this threshold.
- Similar added check for invariant stores vs total stores in loop, kept this
threshold as a hard value 40%(total instruction of loop), also provided option
to control this threshold.
- Introduced threshold command line parameter to control loop nest,
benefit threshold etc.
This option is to control invariant store vs total store threshold,
default 40% of total instruction.
This option is to control invariant load & store vs total instruction threshold,
default 25% of total instruction.
This option is to control maximum depth for loops getting considered,
default depth is 2.
This option is to control maximum pointer/address getting considered, default is 5.
Added test cases.
If possible, please review this change.