This is an archive of the discontinued LLVM Phabricator instance.

[DAGCombiner] Hoist funnel shifts from logic operation.
ClosedPublic

Authored by fzhinkin on Aug 2 2022, 9:19 AM.

Details

Summary

Hoist funnel shift from logic op:
logic_op (FSH x0, x1, s), (FSH y0, y1, s) --> FSH (logic_op x0, y0), (logic_op x1, y1), s

The transformation improves code generated for some cases related to issue https://github.com/llvm/llvm-project/issues/49541.

Reduced amount of funnel shifts can also improve throughput on x86 CPUs by utilizing more available ports: https://quick-bench.com/q/gC7AKkJJsDZzRrs_JWDzm9t_iDM

Transformation correctness checks:
https://alive2.llvm.org/ce/z/TKPULH
https://alive2.llvm.org/ce/z/UvTd_9
https://alive2.llvm.org/ce/z/j8qW3_
https://alive2.llvm.org/ce/z/7Wq7gE
https://alive2.llvm.org/ce/z/Xr5w8R
https://alive2.llvm.org/ce/z/D5xe_E
https://alive2.llvm.org/ce/z/2yBZiy

Diff Detail

Event Timeline

fzhinkin created this revision.Aug 2 2022, 9:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 2 2022, 9:19 AM
fzhinkin requested review of this revision.Aug 2 2022, 9:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 2 2022, 9:19 AM
fzhinkin edited the summary of this revision. (Show Details)Aug 2 2022, 9:21 AM

Please pre-commit the new tests with baseline results, so we'll just show the diffs in this patch.
Add an alive2 proof link for at least one of the patterns to the patch description, so we can show correctness.

fzhinkin edited the summary of this revision. (Show Details)Aug 5 2022, 4:58 AM

Please pre-commit the new tests with baseline results, so we'll just show the diffs in this patch.

Unfortunately, I don't have a permission to commit. Here's a patch adding tests with checks generated using llc build from the main branch:

.

I'll appreciate if you can help me with committing it.

Add an alive2 proof link for at least one of the patterns to the patch description, so we can show correctness.

Done, thanks!

spatel added a comment.Aug 5 2022, 7:48 AM

Please pre-commit the new tests with baseline results, so we'll just show the diffs in this patch.

Unfortunately, I don't have a permission to commit. Here's a patch adding tests with checks generated using llc build from the main branch:

.

I'll appreciate if you can help me with committing it.

Sure: 249a7ed75072

Add an alive2 proof link for at least one of the patterns to the patch description, so we can show correctness.

Done, thanks!

Great - please update the patch here Phab with the test changes.

Please pre-commit the new tests with baseline results, so we'll just show the diffs in this patch.

Unfortunately, I don't have a permission to commit. Here's a patch adding tests with checks generated using llc build from the main branch:

.

I'll appreciate if you can help me with committing it.

Sure: 249a7ed75072

Thank you!

Add an alive2 proof link for at least one of the patterns to the patch description, so we can show correctness.

Done, thanks!

Great - please update the patch here Phab with the test changes.

Done

spatel accepted this revision.Aug 5 2022, 11:00 AM

LGTM
I'll push this for you if there are no other comments.
You could request commit access now (given your patch history, I don't think there would be a problem):
https://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access

This revision is now accepted and ready to land.Aug 5 2022, 11:00 AM
This revision was landed with ongoing or failed builds.Aug 5 2022, 2:02 PM
This revision was automatically updated to reflect the committed changes.

LGTM
I'll push this for you if there are no other comments.
You could request commit access now (given your patch history, I don't think there would be a problem):
https://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access

Thank you!