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.
In the future, can you do a full-context diff? It lets reviewers see the full file.
git show -U999999
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.
Could this use matchConstantOp?
- Changed mul_by_one to right_identity_one
- Changed mul_by_neg_one to use matchConstantOp
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