This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Check if the pre-increment preparations have already been made so that they are not done twice
ClosedPublic

Authored by stefanp on Aug 15 2017, 6:36 AM.

Details

Summary

Preparations to use the per-increment are sometimes done in the target independent pass Loop Strength Reduction.
We try to detect them in the PowerPC specific pass so that they are not done twice and so that we do not add PHIs that are not required.

Diff Detail

Repository
rL LLVM

Event Timeline

stefanp created this revision.Aug 15 2017, 6:36 AM
hfinkel added inline comments.Aug 15 2017, 8:49 PM
lib/Target/PowerPC/PPCLoopPreIncPrep.cpp
186 ↗(On Diff #111153)

Please add a comment here explaining what this function is doing.

189 ↗(On Diff #111153)

Local variables start with a capital letter (here and a bunch of places below).

203 ↗(On Diff #111153)

Extra spaces inside parens.

212 ↗(On Diff #111153)

I don't believe that getSCEVAtScope can return nullptr.

219 ↗(On Diff #111153)

This can't be null.

223 ↗(On Diff #111153)

Indentation looks odd here (you might try running clang-format over the patch).

234 ↗(On Diff #111153)

This phrasing is confusing (it sounds like you're saying that the start and the increment are identical to each other).

417 ↗(On Diff #111153)

Space after if.

stefanp updated this revision to Diff 111389.Aug 16 2017, 11:20 AM

Updated based on comments from Hal Finkel.

hfinkel added inline comments.Aug 17 2017, 9:25 AM
lib/Target/PowerPC/PPCLoopPreIncPrep.cpp
65 ↗(On Diff #111389)

How about "PHI node already in pre-increment form" (no period at the end).

193 ↗(On Diff #111389)

Remove this variable, it is not needed (and see comment below).

206 ↗(On Diff #111389)

Extra spaces inside < >.

207 ↗(On Diff #111389)

Please be consistent in capitalization. PHI is more common in LLVM than Phi, and we use PHI already in this source file. Make this PHIInter and so on.

235 ↗(On Diff #111389)

FoundPHI is not needed. Instead of setting FoundPHI to true here, you can just

++PHINodeAlreadyExists;
return true;
stefanp updated this revision to Diff 111667.Aug 18 2017, 6:31 AM

Update based on comments from Hal.

This revision is now accepted and ready to land.Aug 18 2017, 11:49 AM
This revision was automatically updated to reflect the committed changes.
stefanp marked an inline comment as done.