This is an archive of the discontinued LLVM Phabricator instance.

[LV] Pull creation of trip counts into a helper function.
ClosedPublic

Authored by jmolloy on Aug 30 2015, 4:05 AM.

Details

Summary

... and do a tad of tidyup while we're at it. Because StartIdx must now be zero, there's no difference between Count and EndIdx.

Moving this to helper functions reduces the complexity of createEmptyLoop.

Diff Detail

Repository
rL LLVM

Event Timeline

jmolloy updated this revision to Diff 33529.Aug 30 2015, 4:05 AM
jmolloy retitled this revision from to [LV] Pull creation of trip counts into a helper function..
jmolloy updated this object.
jmolloy added reviewers: anemet, hfinkel, mzolotukhin.
jmolloy set the repository for this revision to rL LLVM.
jmolloy added a subscriber: llvm-commits.
mzolotukhin edited edge metadata.Aug 30 2015, 1:44 PM

Hi James,

Comments inline:

lib/Transforms/Vectorize/LoopVectorize.cpp
2763

This insertion point is overwritten a couple of lines below.

2789

Please double-check whether we generate instructions at the same location, as before the change. I suspect we're doing it in VecBody instead of VectorPH now, though I didn't check it.
Also, since it's an NFC, it would be a good to verify it by comparing output IR on existing tests before and after the change.

jmolloy marked an inline comment as done.Aug 31 2015, 10:11 AM
jmolloy added inline comments.
lib/Transforms/Vectorize/LoopVectorize.cpp
2789

I've checked, and there's no code changes we weren't expecting. L2654 is where the instructions are created, and that's at the end of the preheader.

jmolloy updated this revision to Diff 33591.Aug 31 2015, 10:16 AM
jmolloy edited edge metadata.
jmolloy updated this revision to Diff 33596.Aug 31 2015, 10:27 AM
anemet edited edge metadata.Aug 31 2015, 11:45 AM

James, looks like you uploaded 75's diff here by mistake?

jmolloy updated this revision to Diff 33616.Aug 31 2015, 1:03 PM
jmolloy edited edge metadata.

Hi Adam,

So I did. Thanks for pointing that out!

anemet added inline comments.Sep 1 2015, 11:29 PM
lib/Transforms/Vectorize/LoopVectorize.cpp
2617–2618

I'll let Michael give final OK but since you're cleaning this up, it would be good to finally rename this to BackedgeTakenCount or something. Later the code redefines this same variable to the *real* exit count which is pretty crazy. These two values should be different variables.

Oh and needless to say, awesome cleanup, thanks for your work!

mzolotukhin accepted this revision.Sep 1 2015, 11:45 PM
mzolotukhin edited edge metadata.

Provided the spotted issues are fixed, the patch LGTM. Thanks, James!

Michael

lib/Transforms/Vectorize/LoopVectorize.cpp
2763

This is still the issue:)

2770

Here it's overwritten before any use. One of these two SetInsertPoints is redundant.

This revision is now accepted and ready to land.Sep 1 2015, 11:45 PM
jmolloy closed this revision.Sep 2 2015, 4:56 AM

Fixed this time (sorry, git rebase problems :( ) - r246633.

anemet added inline comments.Sep 2 2015, 10:32 AM
lib/Transforms/Vectorize/LoopVectorize.cpp
2617–2618

Looks like you didn't make this change in the commit.