This is an archive of the discontinued LLVM Phabricator instance.

[SCEV] Postpone ScalarEvolution::forgetLoop after TripCountSC is expanded when unroll runtime iteration loop
ClosedPublic

Authored by wmi on Aug 16 2016, 9:59 AM.

Details

Summary

In llvm::UnrollRuntimeLoopRemainder, if the loop to be unrolled is the inner loop inside a loop nest, the scalar evolution needs to be dropped for its parent loop which is done by ScalarEvolution::forgetLoop. However, we can postpone forgetLoop to the end of UnrollRuntimeLoopRemainder so TripCountSC expansion can still reuse existing value.

Diff Detail

Repository
rL LLVM

Event Timeline

wmi updated this revision to Diff 68207.Aug 16 2016, 9:59 AM
wmi retitled this revision from to [SCEV] Postpone ScalarEvolution::forgetLoop after TripCountSC is expanded when unroll runtime iteration loop.
wmi updated this object.
wmi added a reviewer: sanjoy.
wmi set the repository for this revision to rL LLVM.
wmi added subscribers: llvm-commits, davidxl, mkuper.
wmi added a comment.Aug 23 2016, 2:16 PM

Gentle Ping.

sanjoy edited edge metadata.Aug 23 2016, 10:59 PM
sanjoy added subscribers: evstupac, mzolotukhin.

Hi Wei,

I don't think I'm the best person to review this code, I think you should ask either @mzolotukhin or @evstupac.

mzolotukhin accepted this revision.Aug 24 2016, 11:36 AM
mzolotukhin edited edge metadata.

The change looks good to me, thanks!

Michael

test/Analysis/ScalarEvolution/scev-expander-existing-value.ll
0

Would it make sense to separate the test into two files maybe? Right now we run opt twice on this file but only check the output of one half each run. Ideally, we could somehow use the same routine for both vectorizer and unroller runs, but I don't know if that's possible.

This revision is now accepted and ready to land.Aug 24 2016, 11:36 AM
wmi updated this revision to Diff 69173.Aug 24 2016, 2:54 PM
wmi edited edge metadata.

Sanjoy and Michael, thanks!

Separate the test into two.

This revision was automatically updated to reflect the committed changes.