[Mlir-commits] [mlir] [MLIR][OpenMP] Remove OpenMPDialectFoldInterface (PR #97577)

Sergio Afonso llvmlistbot at llvm.org
Wed Jul 3 06:50:00 PDT 2024


https://github.com/skatrak created https://github.com/llvm/llvm-project/pull/97577

The `OpenMPDialectFoldInterface` was originally introduced to prevent constants from being hoisted out of `omp.target` regions. This hasn't been necessary since the `IsolatedFromAbove` trait was added to that operation, so it's safe to remove this interface.

>From f5cdb86241e6e7af6657ba270e6c33b8ff68c3fb Mon Sep 17 00:00:00 2001
From: Sergio Afonso <safonsof at amd.com>
Date: Wed, 3 Jul 2024 14:35:57 +0100
Subject: [PATCH] [MLIR][OpenMP] Remove OpenMPDialectFoldInterface

The `OpenMPDialectFoldInterface` was originally introduced to prevent constants
from being hoisted out of `omp.target` regions. This hasn't been necessary
since the `IsolatedFromAbove` trait was added to that operation, so it's safe
to remove this interface.
---
 mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
index abbd857dad67a..ba29e564afc2c 100644
--- a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
+++ b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
@@ -66,15 +66,6 @@ struct LLVMPointerPointerLikeModel
                                             LLVM::LLVMPointerType> {
   Type getElementType(Type pointer) const { return Type(); }
 };
-
-struct OpenMPDialectFoldInterface : public DialectFoldInterface {
-  using DialectFoldInterface::DialectFoldInterface;
-
-  bool shouldMaterializeInto(Region *region) const final {
-    // Avoid folding constants across target regions
-    return isa<TargetOp>(region->getParentOp());
-  }
-};
 } // namespace
 
 void OpenMPDialect::initialize() {
@@ -91,7 +82,6 @@ void OpenMPDialect::initialize() {
 #include "mlir/Dialect/OpenMP/OpenMPOpsTypes.cpp.inc"
       >();
 
-  addInterface<OpenMPDialectFoldInterface>();
   MemRefType::attachInterface<MemRefPointerLikeModel>(*getContext());
   LLVM::LLVMPointerType::attachInterface<LLVMPointerPointerLikeModel>(
       *getContext());



More information about the Mlir-commits mailing list