[Mlir-commits] [mlir] 406b887 - [MLIR][AMX] Remove llvm.ptr<i8> bitcasts from legalize for LLVM pass

Christian Ulmann llvmlistbot at llvm.org
Fri Nov 3 14:34:24 PDT 2023


Author: Christian Ulmann
Date: 2023-11-03T22:31:36+01:00
New Revision: 406b887ad71439bd0af44ab93ed318aea4c83f36

URL: https://github.com/llvm/llvm-project/commit/406b887ad71439bd0af44ab93ed318aea4c83f36
DIFF: https://github.com/llvm/llvm-project/commit/406b887ad71439bd0af44ab93ed318aea4c83f36.diff

LOG: [MLIR][AMX] Remove llvm.ptr<i8> bitcasts from legalize for LLVM pass

This commit removes the no longer required `llvm.ptr<i8>` bitcasts from
AMX's legalize-for-llvm-export pass. Typed pointers have been
deprecated for a while now and it's planned to soon remove them from
the LLVM dialect.

Related PSA: https://discourse.llvm.org/t/psa-removal-of-typed-pointers-from-the-llvm-dialect/74502

Added: 
    

Modified: 
    mlir/lib/Dialect/AMX/Transforms/LegalizeForLLVMExport.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/AMX/Transforms/LegalizeForLLVMExport.cpp b/mlir/lib/Dialect/AMX/Transforms/LegalizeForLLVMExport.cpp
index 1355af146607767..a8b10f63315d415 100644
--- a/mlir/lib/Dialect/AMX/Transforms/LegalizeForLLVMExport.cpp
+++ b/mlir/lib/Dialect/AMX/Transforms/LegalizeForLLVMExport.cpp
@@ -73,13 +73,6 @@ Value getStride(ConversionPatternRewriter &rewriter,
   return rewriter.create<LLVM::ConstantOp>(loc, llvmInt64Type, attr);
 }
 
-/// Cast any pointer to the !llvm.ptr<i8> pointer type.
-Value castPtr(ConversionPatternRewriter &rewriter, Location loc, Value ptr) {
-  auto i8Ptr =
-      LLVM::LLVMPointerType::get(IntegerType::get(ptr.getContext(), 8));
-  return rewriter.create<LLVM::BitcastOp>(loc, i8Ptr, ptr);
-}
-
 struct TileZeroConversion : public ConvertOpToLLVMPattern<TileZeroOp> {
   using ConvertOpToLLVMPattern<TileZeroOp>::ConvertOpToLLVMPattern;
   LogicalResult
@@ -116,7 +109,6 @@ struct TileLoadConversion : public ConvertOpToLLVMPattern<TileLoadOp> {
     // Replace operation with intrinsic.
     Value ptr = getStridedElementPtr(op.getLoc(), mType, adaptor.getBase(),
                                      adaptor.getIndices(), rewriter);
-    ptr = castPtr(rewriter, op.getLoc(), ptr);
     Type resType = typeConverter->convertType(vType);
     rewriter.replaceOpWithNewOp<amx::x86_amx_tileloadd64>(
         op, resType, tsz.first, tsz.second, ptr, stride);
@@ -143,7 +135,6 @@ struct TileStoreConversion : public ConvertOpToLLVMPattern<TileStoreOp> {
     // Replace operation with intrinsic.
     Value ptr = getStridedElementPtr(op.getLoc(), mType, adaptor.getBase(),
                                      adaptor.getIndices(), rewriter);
-    ptr = castPtr(rewriter, op.getLoc(), ptr);
     rewriter.replaceOpWithNewOp<amx::x86_amx_tilestored64>(
         op, tsz.first, tsz.second, ptr, stride, adaptor.getVal());
     return success();


        


More information about the Mlir-commits mailing list