[PATCH] D136754: [MachineCombiner] Extend reassociation logic to handle inverse instructions
Anton Sidorenko via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 26 05:09:44 PDT 2022
asi-sc added reviewers: Carrot, dmgreen, craig.topper, spatel, shchenz.
asi-sc added a comment.
Herald added a subscriber: StephenFan.
Some support of add-sub reassociation was added to AArch64 in D124564 <https://reviews.llvm.org/D124564>. This patch generalizes this idea and makes implementation target-independent.
It also introduces one more invariant to machine combiner that is REASSOC_AX/XA_BY/YB patterns must be gathered only with standard mechanism (`isAssociativeAndCommutative` function, etc. ) if reassociation is performed by default implementation. This sounds reasonable for me: if we have custom pattern matcher, we must be ready to write custom reassociation. All targets except RISCV that use machine-combine do not contradict the new invariant. If this patch gets positive feedback, I'll change RISCV implementation accordingly. It will require a few changes.
There is a big diff for tests, but it is just a change in the order of operands in commutative instructions. This is required to generalize the transformation rules.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136754/new/
https://reviews.llvm.org/D136754
More information about the llvm-commits
mailing list