This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Use range for loops (NFC)
ClosedPublic

Authored by rickyz on Dec 20 2021, 10:38 PM.

Diff Detail

Event Timeline

rickyz created this revision.Dec 20 2021, 10:38 PM
rickyz published this revision for review.EditedDec 20 2021, 11:01 PM

Apologies for the size of this cleanup change - the changes were mostly mechanical, aside from having to check for iterator invalidation issues (I did not find any).

I'm new to LLVM development, so please let me know if it's preferred to split this into smaller changes, or if these changes cause too much churn to be considered worthwhile - happy to scope it more tightly if so!

Herald added a project: Restricted Project. · View Herald TranscriptDec 20 2021, 11:01 PM
nikic added a subscriber: nikic.Dec 20 2021, 11:52 PM
nikic added inline comments.
llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
194

Iterating over BB->phis() would be more elegant here.

rickyz updated this revision to Diff 395616.Dec 21 2021, 12:58 AM
rickyz marked an inline comment as done.

Use BB->phis() for iterating over PHIs.

That's more cleanup than I was expecting. :)
I think it's all worth doing, but let's commit the capitalization and other small (else-after-return, etc.) changes first. The range-for diffs can expose subtle logic changes, so that can be its own patch or set of patches to limit risk.

rickyz updated this revision to Diff 404333.Jan 29 2022, 9:12 PM

Rebasing on top of D118553.

Apologies for the long-delayed response on these changes. I've split out the trivial changes into D118553 - does that look reasonable? I'm not an LLVM committer, so would you mind landing the changes in this series for me once they are approved? Thanks!

rickyz edited the summary of this revision. (Show Details)Jan 29 2022, 9:18 PM
spatel accepted this revision.Jan 30 2022, 5:01 AM

Apologies for the long-delayed response on these changes. I've split out the trivial changes into D118553 - does that look reasonable? I'm not an LLVM committer, so would you mind landing the changes in this series for me once they are approved? Thanks!

LGTM. Thanks for splitting up the pieces. I can push these on your behalf.

This revision is now accepted and ready to land.Jan 30 2022, 5:01 AM
This revision was landed with ongoing or failed builds.Jan 30 2022, 6:17 AM
Closed by commit rGde80b53d1acf: [InstCombine] Use range for loops (NFC) (authored by rickyz, committed by spatel). · Explain Why
This revision was automatically updated to reflect the committed changes.