[Matrix] Use alignment info when lowering loads/stores.
authorFlorian Hahn <flo@fhahn.com>
Thu, 18 Jun 2020 12:06:00 +0000 (13:06 +0100)
committerFlorian Hahn <flo@fhahn.com>
Thu, 18 Jun 2020 12:19:31 +0000 (13:19 +0100)
commit1669fddc9f6096a5c674ba0a459403ea2c5ffd9c
tree8a615fcf517d1b0e8096e99b837a75a33fdf2808
parent3cfd74e64be2b283bb6205c629796f58c8aca47c
[Matrix] Use alignment info when lowering loads/stores.

This patch updates LowerMatrixIntrinsics to preserve the alignment
specified at the original load/stores and the align attribute for the
pointer argument of the column.major.load/store intrinsics.

We can always use the specified alignment for the load of the first
column. For subsequent columns, the alignment may need to be reduced.

For ConstantInt strides, compute the offset for the start of the column in
bytes and use commonAlignment to get the largest valid alignment.

For non-ConstantInt strides, we need to take the common alignment of the
initial alignment and the element size in bytes.

Reviewers: anemet, Gerolf, hfinkel, andrew.w.kaylor, LuoYuanke, rjmccall

Reviewed By: rjmccall

Differential Revision: https://reviews.llvm.org/D81960
llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
llvm/test/Transforms/LowerMatrixIntrinsics/const-gep.ll
llvm/test/Transforms/LowerMatrixIntrinsics/load-align-volatile.ll
llvm/test/Transforms/LowerMatrixIntrinsics/store-align-volatile.ll