Skip to content

Commit 41f3b83

Browse files
authored
[MLIR][SPIRVToLLVM] Remove typed pointer support (#70568)
This commit removes the support for lowering SPIRV to LLVM dialect with typed pointers. 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
1 parent 130b149 commit 41f3b83

22 files changed

+21
-43
lines changed

mlir/include/mlir/Conversion/Passes.td

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,9 +1016,6 @@ def ConvertSPIRVToLLVMPass : Pass<"convert-spirv-to-llvm", "ModuleOp"> {
10161016
let dependentDialects = ["LLVM::LLVMDialect"];
10171017

10181018
let options = [
1019-
Option<"useOpaquePointers", "use-opaque-pointers", "bool",
1020-
/*default=*/"true", "Generate LLVM IR using opaque pointers "
1021-
"instead of typed pointers">,
10221019
Option<"clientAPI", "client-api", "::mlir::spirv::ClientAPI",
10231020
/*default=*/"::mlir::spirv::ClientAPI::Unknown",
10241021
"Derive StorageClass to address space mapping from the client API",

mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,8 +1376,8 @@ class BitcastConversionPattern
13761376
if (!dstType)
13771377
return failure();
13781378

1379-
if (typeConverter.useOpaquePointers() &&
1380-
isa<LLVM::LLVMPointerType>(dstType)) {
1379+
// LLVM's opaque pointers do not require bitcasts.
1380+
if (isa<LLVM::LLVMPointerType>(dstType)) {
13811381
rewriter.replaceOp(bitcastOp, adaptor.getOperand());
13821382
return success();
13831383
}

mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ void ConvertSPIRVToLLVMPass::runOnOperation() {
4242
ModuleOp module = getOperation();
4343

4444
LowerToLLVMOptions options(&getContext());
45-
options.useOpaquePointers = useOpaquePointers;
4645

4746
LLVMTypeConverter converter(&getContext(), options);
4847

mlir/test/Conversion/SPIRVToLLVM/arithmetic-ops-to-llvm.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: mlir-opt -convert-spirv-to-llvm='use-opaque-pointers=1' %s | FileCheck %s
1+
// RUN: mlir-opt -convert-spirv-to-llvm %s | FileCheck %s
22

33
//===----------------------------------------------------------------------===//
44
// spirv.IAdd

mlir/test/Conversion/SPIRVToLLVM/bitwise-ops-to-llvm.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: mlir-opt -convert-spirv-to-llvm='use-opaque-pointers=1' %s | FileCheck %s
1+
// RUN: mlir-opt -convert-spirv-to-llvm %s | FileCheck %s
22

33
//===----------------------------------------------------------------------===//
44
// spirv.BitCount

mlir/test/Conversion/SPIRVToLLVM/cast-ops-to-llvm.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: mlir-opt -convert-spirv-to-llvm='use-opaque-pointers=1' %s | FileCheck %s
1+
// RUN: mlir-opt -convert-spirv-to-llvm %s | FileCheck %s
22

33
//===----------------------------------------------------------------------===//
44
// spirv.Bitcast

mlir/test/Conversion/SPIRVToLLVM/comparison-ops-to-llvm.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: mlir-opt -convert-spirv-to-llvm='use-opaque-pointers=1' %s | FileCheck %s
1+
// RUN: mlir-opt -convert-spirv-to-llvm %s | FileCheck %s
22

33
//===----------------------------------------------------------------------===//
44
// spirv.IEqual

mlir/test/Conversion/SPIRVToLLVM/constant-op-to-llvm.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: mlir-opt -convert-spirv-to-llvm='use-opaque-pointers=1' %s | FileCheck %s
1+
// RUN: mlir-opt -convert-spirv-to-llvm %s | FileCheck %s
22

33
//===----------------------------------------------------------------------===//
44
// spirv.Constant

mlir/test/Conversion/SPIRVToLLVM/control-flow-ops-to-llvm.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: mlir-opt -convert-spirv-to-llvm='use-opaque-pointers=1' -split-input-file -verify-diagnostics %s | FileCheck %s
1+
// RUN: mlir-opt -convert-spirv-to-llvm -split-input-file -verify-diagnostics %s | FileCheck %s
22

33
//===----------------------------------------------------------------------===//
44
// spirv.Branch

mlir/test/Conversion/SPIRVToLLVM/func-ops-to-llvm.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: mlir-opt -convert-spirv-to-llvm='use-opaque-pointers=1' %s | FileCheck %s
1+
// RUN: mlir-opt -convert-spirv-to-llvm %s | FileCheck %s
22

33
//===----------------------------------------------------------------------===//
44
// spirv.Return

0 commit comments

Comments
 (0)