If one of the operands is negated in a multiplication we can optimise the operation by moving the negation to the smallest operand or to the result
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Thanks for the update! Could you also add quick comments to the test cases documenting the expected behavior? It would also good to have test cases with chains of matrix multiplies, where some arguments are negated. They don't need to be optimized by the first patch, but it would be good to make sure we do not crash on such cases (or run into an instcombine cycle)
Add more test casses to address the following:
- Multiple matrix multiply operation
- Negation on both operands
- Negation on the result
llvm/test/Transforms/InstCombine/matrix-multiplication-negation.ll | ||
---|---|---|
2 | nit: is UTC_ARGS: --force-update really needed? | |
5 | could you also add versions of test_negation_move_to_result & test_negation_not_moved where the second operand is negated instead? | |
16 | Could also add another version of the test where the negation is moved from the second to the first operand? | |
27 | Could you add quick comments to the tests saying why the negation should or should not be moved? | |
69 | %b.neg isn't used? | |
90 | AFAICT there's no case at the moment where it would be profitable to move the negation with chains, right? Could you add it? |
LGTM, thanks for the recent changes! If there are additional test cases needed those can be submitted as follow-up I think.
nit: is UTC_ARGS: --force-update really needed?