This is an archive of the discontinued LLVM Phabricator instance.

[GISel] Add new GISel combiners for G_MUL
ClosedPublic

Authored by mkitzan on Sep 14 2020, 8:05 PM.

Details

Summary

Patch adds two new GICombinerRules, one for G_MUL(X, 1) and another for G_MUL(X, -1). G_MUL(X, 1) is an identity combine, and G_MUL(X, -1) gets replaced with G_SUB(0, X). Patch additionally adds new combiner tests for the AArch64 target to test these new combiner rules, as well as updates AMDGPU GISel tests.

Diff Detail

Event Timeline

mkitzan created this revision.Sep 14 2020, 8:05 PM
mkitzan requested review of this revision.Sep 14 2020, 8:05 PM
mkitzan updated this revision to Diff 291765.Sep 14 2020, 8:18 PM
  • Rebased and fixed merge conflicts

In the future, can you do a full-context diff? It lets reviewers see the full file.

e.g.

git show -U999999

llvm/include/llvm/Target/GlobalISel/Combine.td
441

This could probably be a right_identity_one combine, similar to right_identity_zero. Then you can add any other operators where this is true to the wip_match_opcode list in a follow-up.

453

Could this use matchConstantOp?

mkitzan updated this revision to Diff 291991.Sep 15 2020, 12:17 PM
  • Changed mul_by_one to right_identity_one
  • Changed mul_by_neg_one to use matchConstantOp
This revision is now accepted and ready to land.Sep 15 2020, 1:13 PM

Thanks for the review. Still don't have commit access, will need someone to commit on my behalf. Thanks in advance!

Thanks for the review. Still don't have commit access, will need someone to commit on my behalf. Thanks in advance!

I can commit for you this time as well. Can you email Chris to request for access as mentioned here? - https://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access

Thanks again Aditya! I'll reach out to Chris about commit access.