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

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

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

189

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

203

Extra spaces inside parens.

212

I don't believe that getSCEVAtScope can return nullptr.

219

This can't be null.

223

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

234

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

417

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

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

193

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

206

Extra spaces inside < >.

207

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

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.