Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve selection criteria for IndVarEliminination
Add post dominance check for primary induction variable(PIV) and derived induction variable(DIV) to improve selection criteria for `redundantInductionVarElimination` optimization. Previously when checking whether or not to replace a DIV with PIV one of the things we did was count the number of increments. We replaced DIV with PIV only if both had equal number of increments. However, when counting the increments we did not check if those increments were in the same block. Because of this we would sometimes replace a DIV even if it was in a different block than the PIV it was being replaced with. This resulted in addition of extra add and load instructions to compensate for the different block locations. Addition of those extra add and load instructions resulted in a performance regression. To combat this regression, we have added domination relationship check for PIV and DIV. DIV will be replaced only if every increment of the DIV being replaced is post dominated by at least one PIV increment. This helps ensure we don't replace a DIV which needs extra instructions to load PIV. This change is not enabled on x platform as the complex addressing modes mitigate the complexity of the expression used to eliminate the derived induction variable. The post dominate check can be disabled by setting `TR_DisableIVEPostDominatorsCheck` environment variable Signed-off-by: Shubham Verma <shubhamv.sv@gmail.com>
- Loading branch information