[Mlir-commits] [mlir] 6a10381 - [mlir][llvm] Fix for MemRefBuilder when using opaque pointers.

Stephan Herhut llvmlistbot at llvm.org
Tue Apr 18 01:02:35 PDT 2023


Author: Stephan Herhut
Date: 2023-04-18T10:02:23+02:00
New Revision: 6a10381b6f123631db37007e9f9ecbe4559cf29e

URL: https://github.com/llvm/llvm-project/commit/6a10381b6f123631db37007e9f9ecbe4559cf29e
DIFF: https://github.com/llvm/llvm-project/commit/6a10381b6f123631db37007e9f9ecbe4559cf29e.diff

LOG: [mlir][llvm] Fix for MemRefBuilder when using opaque pointers.

Loading the offset of an unranked memref descriptor is creating an invalid load.

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

Added: 
    

Modified: 
    mlir/lib/Conversion/LLVMCommon/MemRefBuilder.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Conversion/LLVMCommon/MemRefBuilder.cpp b/mlir/lib/Conversion/LLVMCommon/MemRefBuilder.cpp
index 12f63cba579f4..248aab3d6838b 100644
--- a/mlir/lib/Conversion/LLVMCommon/MemRefBuilder.cpp
+++ b/mlir/lib/Conversion/LLVMCommon/MemRefBuilder.cpp
@@ -482,7 +482,8 @@ Value UnrankedMemRefDescriptor::offset(OpBuilder &builder, Location loc,
                                        LLVM::LLVMPointerType elemPtrType) {
   Value offsetPtr =
       offsetBasePtr(builder, loc, typeConverter, memRefDescPtr, elemPtrType);
-  return builder.create<LLVM::LoadOp>(loc, offsetPtr);
+  return builder.create<LLVM::LoadOp>(loc, typeConverter.getIndexType(),
+                                      offsetPtr);
 }
 
 void UnrankedMemRefDescriptor::setOffset(OpBuilder &builder, Location loc,


        


More information about the Mlir-commits mailing list