[all-commits] [llvm/llvm-project] c336a0: [mlir] [memref] Fix alignment bug in memref.copy l...

Felix Schneider via All-commits all-commits at lists.llvm.org
Thu Sep 14 04:18:29 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c336a06144a7bc93156fa01d5489f8d738cdb590
      https://github.com/llvm/llvm-project/commit/c336a06144a7bc93156fa01d5489f8d738cdb590
  Author: Felix Schneider <fx.schn at gmail.com>
  Date:   2023-09-14 (Thu, 14 Sep 2023)

  Changed paths:
    M mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
    M mlir/test/Conversion/MemRefToLLVM/memref-to-llvm.mlir
    M mlir/test/Conversion/MemRefToLLVM/typed-pointers.mlir

  Log Message:
  -----------
  [mlir] [memref] Fix alignment bug in memref.copy lowering

memref.copy gets lowered to a function call sometimes, this function
is passed the element size of the memref in bytes as an argument.
The element size passed to the copyMemRef() function call can be
miscalculated if the LLVM IR uses aligned access to the memory.

This can be fixed by using llvm.getelementptr to calculate the element
size natively. This is also done in the other lowering path that lowers
to an intrinsic.

Fix https://github.com/llvm/llvm-project/issues/64072

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D156126




More information about the All-commits mailing list