This is an archive of the discontinued LLVM Phabricator instance.

[PATCH] Force RerollLoop pass to reset the loop trip count value for rerolled loops
ClosedPublic

Authored by zinovy.nis on Mar 21 2016, 8:07 AM.

Details

Summary

It's a bug fix.
For rerolled loops SE trip count remains unchanged. It leads to incorrect work of the next passes.

My patch just resets SE info for rerolled loop forcing SE to re-evaluate it next time it requested.

I also added a verifier call in the exisitng test to be sure no invalid SE data remain. Without my fix this test would fail with -verify-scev.

Diff Detail

Repository
rL LLVM

Event Timeline

zinovy.nis updated this revision to Diff 51163.Mar 21 2016, 8:07 AM
zinovy.nis retitled this revision from to [PATCH] Force RerollLoop pass to reset the loop trip count value for rerolled loops.
zinovy.nis updated this object.
zinovy.nis added reviewers: chandlerc, hulx2000.
zinovy.nis set the repository for this revision to rL LLVM.
zinovy.nis added subscribers: Ayal, aturetsk, pavel.v.chupin.
zinovy.nis updated this object.Mar 21 2016, 8:10 AM
zinovy.nis removed rL LLVM as the repository for this revision.
zinovy.nis added a subscriber: llvm-commits.
Ayal added a comment.Mar 21 2016, 10:36 AM

Nice catch. Looks good to me. Just to clarify, the testcase currently fails with -verify-scev, right?

Ayal added a comment.Mar 21 2016, 10:44 AM

You may want to add Hal Finkel (if others don't review); he seems to have last touched that code according to svn blame ;-) (And James Molloy claimed last week to have rewritten it).

In D18316#379451, @Ayal wrote:

the testcase currently fails with -verify-scev, right?

Yes, it fails.

zinovy.nis added a subscriber: zansari.
zinovy.nis updated this object.
zinovy.nis updated this object.
zinovy.nis updated this object.Mar 22 2016, 1:47 AM
jmolloy accepted this revision.Mar 22 2016, 5:14 AM
jmolloy edited edge metadata.

LGTM too, thanks for this!

This revision is now accepted and ready to land.Mar 22 2016, 5:14 AM
This revision was automatically updated to reflect the committed changes.