[Matrix] Simplify matmuls with scalars
authorFrancis Visoiu Mistrih <francisvm@yahoo.com>
Thu, 1 Sep 2022 19:06:59 +0000 (12:06 -0700)
committerFrancis Visoiu Mistrih <francisvm@yahoo.com>
Fri, 2 Sep 2022 22:50:25 +0000 (15:50 -0700)
commit81bdb4068d92de50e25e4c214960aa5b9598dbbe
treeba5c6a68dab68fd9b6cf56ef45f350ec2da8f92f
parenta7395b860bc247c9e4e917bf5786c04d4cccf1d7
[Matrix] Simplify matmuls with scalars

If one of the operands is a transposed splat, the transpose can be
removed.

This is useful to simplify when transposes are distributed to operands
of a matmul:

* k^T -> k
* (A * k)^t -> A^t * k

Differential Revision: https://reviews.llvm.org/D130177
llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
llvm/test/Transforms/LowerMatrixIntrinsics/after-transpose-opts.ll [new file with mode: 0644]