This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] refactor the SimplifyUsingDistributiveLaws NFC
ClosedPublic

Authored by Allen on Oct 29 2022, 6:10 AM.

Details

Summary

Create a helper function for the Factorization set of folds to avoid shadow
variable declaration.

Diff Detail

Event Timeline

Allen created this revision.Oct 29 2022, 6:10 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 29 2022, 6:10 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
Allen requested review of this revision.Oct 29 2022, 6:10 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 29 2022, 6:10 AM
spatel added inline comments.Oct 29 2022, 8:08 AM
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
636–639

Make this static?

733

The current formatting rules say function names begin with a lower-case letter.
I'd prefer not to use the term "Simplify" here because that implies that we are not creating new values (InstSimplify).
Use "doFactorization()" or "tryFactorizationFolds" or some variant of that?

776

Since we're making changes here, I'd rename this to meet current formatting guidelines.
"foldUsingDistributiveLaws()" ?

Allen updated this revision to Diff 471763.Oct 29 2022, 11:14 AM

Address comments

Allen marked 3 inline comments as done.Oct 29 2022, 7:14 PM
Allen added inline comments.
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
733

Done, thanks

776

Apply your comment, thanks

spatel accepted this revision.Oct 30 2022, 5:51 AM

LGTM

This revision is now accepted and ready to land.Oct 30 2022, 5:51 AM
This revision was automatically updated to reflect the committed changes.
Allen marked 2 inline comments as done.