This is an archive of the discontinued LLVM Phabricator instance.

Allow general loops with one latch
ClosedPublic

Authored by jdoerfert on Sep 10 2015, 7:08 AM.

Details

Summary
As we do not rely on ScalarEvolution any more we do not need to get
the backedge taken count. Additionally, our domain generation handles
everything that is affine and has one latch and our ScopDetection will
over-approximate everything else.

This change will therefor allow loops with:
  - one latch
  - exiting conditions that are affine

Additionally, it will not check for structured control flow anymore.
Hence, loops and conditionals are not necessarily single entry single
exit regions any more.

Diff Detail

Event Timeline

jdoerfert updated this revision to Diff 34436.Sep 10 2015, 7:08 AM
jdoerfert retitled this revision from to Allow general loops with one latch.
jdoerfert added reviewers: grosser, Meinersbur.
jdoerfert updated this object.
jdoerfert added a subscriber: Restricted Project.
grosser accepted this revision.Sep 10 2015, 7:17 AM
grosser edited edge metadata.

Two small comments, otherwise this looks good to me.

Tobias

P.S: Please remember to add [Polly] as a tag to not confuse LLVM developers.

lib/Analysis/ScopDetection.cpp
706

typo: a valid exiting

lib/Analysis/ScopInfo.cpp
1708

Is it necessary to move this code around? This seems to unnecessarily complicate the diff

This revision is now accepted and ready to land.Sep 10 2015, 7:17 AM
Meinersbur accepted this revision.Sep 10 2015, 9:47 AM
Meinersbur edited edge metadata.
Meinersbur added inline comments.
include/polly/ScopInfo.h
654

This change looks unrelated

lib/Analysis/ScopInfo.cpp
981

Can we have an assert here to ensure that the id has been set before?

1494

Rename to setDomainDimId?
"add" made me think it would append another dimension.

1515

for (int LD = getRelativeLoopDepth(LI.getLoopFor(EntryBB)); LD >= 0; LD-=1)

2137

This may make sense to create an element, but looks wrong.

2139
Schedule = LoopSchedules.count(L) ? LoopSchedules[L].first : nullptr;

as alternative to line 2137

2547

isl_set *LDomain

2552

Loop *PL

lib/Support/ScopHelper.cpp
36

Really good this finally does away

I agree with most comments but I am kinda busy right now. I will come
back to this though.

jdoerfert closed this revision.Sep 10 2015, 11:07 AM