This is an archive of the discontinued LLVM Phabricator instance.

[NFC][SeparateConstOffsetFromGEP] Added flag `lower-gep`
ClosedPublic

Authored by Peakulorain on Feb 13 2023, 10:07 PM.

Details

Summary

We need such a flag to check whether the transformation is correct if LowerGEP was enabled.

Related Differential: https://reviews.llvm.org/D143542

Diff Detail

Event Timeline

Peakulorain created this revision.Feb 13 2023, 10:07 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 13 2023, 10:07 PM
Peakulorain requested review of this revision.Feb 13 2023, 10:07 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 13 2023, 10:07 PM

As LowerGEP is a pass parameter, it would be better to expose it via the NewPM pass parameter intrastructure. It would become something like -passes="separate-const-offset-from-gep<lower-gep>". Grep for FUNCTION_PASS_WITH_PARAMS for some examples.

Peakulorain retitled this revision from [NFC][SeparateConstOffsetFromGEP] Added flag `force-lower-gep` to [NFC][SeparateConstOffsetFromGEP] Added flag `lower-gep`.

As LowerGEP is a pass parameter, it would be better to expose it via the NewPM pass parameter intrastructure. It would become something like -passes="separate-const-offset-from-gep<lower-gep>". Grep for FUNCTION_PASS_WITH_PARAMS for some examples.

Thanks a lot, what you suggested is more elegant.

nikic added a comment.Feb 14 2023, 1:54 AM

I think this is missing a printPipeline method to print back the parameter.

I think this is missing a printPipeline method to print back the parameter.

Thanks for the reminder, updated.

nikic accepted this revision.Feb 14 2023, 5:40 AM

LGTM

This revision is now accepted and ready to land.Feb 14 2023, 5:40 AM
arsenm added a subscriber: arsenm.Feb 14 2023, 5:43 AM
arsenm added inline comments.
llvm/lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp
1383

Single quotes

1386

Single quotes

Peakulorain added inline comments.Feb 14 2023, 6:48 AM
llvm/lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp
1383

I have seen that many passes use double quotes, so it is good to be consistent with everyone here

This revision was landed with ongoing or failed builds.Feb 14 2023, 6:04 PM
This revision was automatically updated to reflect the committed changes.
Peakulorain marked an inline comment as done.Feb 14 2023, 6:47 PM
arsenm added inline comments.Feb 15 2023, 3:28 AM
llvm/lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp
1386

They should all use single quotes, these use different overloads of <<

Peakulorain added inline comments.Feb 15 2023, 3:36 AM
llvm/lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp
1386

Sorry, I thought it was enough to keep the same usage as everyone else, then I will submit another patch and change all double quotes to single quotes