This is an archive of the discontinued LLVM Phabricator instance.

[LoopUnroll] Fix potentially incorrect SCEV invalidation in UnrollRuntime
ClosedPublic

Authored by mkazantsev on Apr 23 2018, 2:27 AM.

Details

Summary

Current runtime unrolling invalidates parent loop saying that it might have changed
after the inner loop has changed, but it doesn't bother to do the same to its parents.
With patch rL329047, SCEV becomes much smarter about calculation of exit counts for
outer loops. We might need to invalidate not only the immediate parent, but also
any of its parents as well.

There is no clear evidence that there is some miscompile happening because of this
(at least I don't have such test), but the common sense says that the current code
is wrong.

Diff Detail

Repository
rL LLVM

Event Timeline

mkazantsev created this revision.Apr 23 2018, 2:27 AM
chandlerc accepted this revision.Apr 23 2018, 2:45 AM

I think the existing testing of the fact that the parent needs invalidation makes perfect sense to switch to the more general API. Good spot. Feel free to commit.

This revision is now accepted and ready to land.Apr 23 2018, 2:45 AM
This revision was automatically updated to reflect the committed changes.