[flang-commits] [flang] Renaming Cuf passes to CUF (PR #113351)

via flang-commits flang-commits at lists.llvm.org
Tue Oct 22 10:48:40 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-fir-hlfir

Author: Renaud Kauffmann (Renaud-K)

<details>
<summary>Changes</summary>

For consistency with other dialects and other CUF passes and files, this patch renames passes CufOpConversion to CUFOpConversion, CufImplicitDeviceGlobal to CUFDeviceGlobal.
It also renames the file.


---
Full diff: https://github.com/llvm/llvm-project/pull/113351.diff


7 Files Affected:

- (renamed) flang/include/flang/Optimizer/Transforms/CUFOpConversion.h (+1-1) 
- (modified) flang/include/flang/Optimizer/Transforms/Passes.h (+1-1) 
- (modified) flang/include/flang/Optimizer/Transforms/Passes.td (+3-3) 
- (modified) flang/lib/Optimizer/Transforms/CMakeLists.txt (+2-2) 
- (renamed) flang/lib/Optimizer/Transforms/CUFDeviceGlobal.cpp (+4-4) 
- (renamed) flang/lib/Optimizer/Transforms/CUFOpConversion.cpp (+3-3) 
- (modified) flang/test/Fir/CUDA/cuda-implicit-device-global.f90 (+1-1) 


``````````diff
diff --git a/flang/include/flang/Optimizer/Transforms/CufOpConversion.h b/flang/include/flang/Optimizer/Transforms/CUFOpConversion.h
similarity index 93%
rename from flang/include/flang/Optimizer/Transforms/CufOpConversion.h
rename to flang/include/flang/Optimizer/Transforms/CUFOpConversion.h
index 0a71cdfddec1ab..3f7a73b6a8bc28 100644
--- a/flang/include/flang/Optimizer/Transforms/CufOpConversion.h
+++ b/flang/include/flang/Optimizer/Transforms/CUFOpConversion.h
@@ -1,4 +1,4 @@
-//===------- Optimizer/Transforms/CufOpConversion.h -------------*- C++ -*-===//
+//===------- Optimizer/Transforms/CUFOpConversion.h -------------*- C++ -*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
diff --git a/flang/include/flang/Optimizer/Transforms/Passes.h b/flang/include/flang/Optimizer/Transforms/Passes.h
index 3b2af3a3398108..5d3067aa359813 100644
--- a/flang/include/flang/Optimizer/Transforms/Passes.h
+++ b/flang/include/flang/Optimizer/Transforms/Passes.h
@@ -40,7 +40,7 @@ namespace fir {
 #define GEN_PASS_DECL_CHARACTERCONVERSION
 #define GEN_PASS_DECL_CFGCONVERSION
 #define GEN_PASS_DECL_CUFADDCONSTRUCTOR
-#define GEN_PASS_DECL_CUFIMPLICITDEVICEGLOBAL
+#define GEN_PASS_DECL_CUFDEVICEGLOBAL
 #define GEN_PASS_DECL_CUFOPCONVERSION
 #define GEN_PASS_DECL_EXTERNALNAMECONVERSION
 #define GEN_PASS_DECL_MEMREFDATAFLOWOPT
diff --git a/flang/include/flang/Optimizer/Transforms/Passes.td b/flang/include/flang/Optimizer/Transforms/Passes.td
index af6bd41cbb71da..2efa543ca07148 100644
--- a/flang/include/flang/Optimizer/Transforms/Passes.td
+++ b/flang/include/flang/Optimizer/Transforms/Passes.td
@@ -421,15 +421,15 @@ def AssumedRankOpConversion : Pass<"fir-assumed-rank-op", "mlir::ModuleOp"> {
   ];
 }
 
-def CufOpConversion : Pass<"cuf-convert", "mlir::ModuleOp"> {
+def CUFOpConversion : Pass<"cuf-convert", "mlir::ModuleOp"> {
   let summary = "Convert some CUF operations to runtime calls";
   let dependentDialects = [
     "fir::FIROpsDialect"
   ];
 }
 
-def CufImplicitDeviceGlobal :
-    Pass<"cuf-implicit-device-global", "mlir::ModuleOp"> {
+def CUFDeviceGlobal :
+    Pass<"cuf-device-global", "mlir::ModuleOp"> {
   let summary = "Flag globals used in device function with data attribute";
   let dependentDialects = [
     "cuf::CUFDialect"
diff --git a/flang/lib/Optimizer/Transforms/CMakeLists.txt b/flang/lib/Optimizer/Transforms/CMakeLists.txt
index 352fe4cbe09e99..8f4f731e009221 100644
--- a/flang/lib/Optimizer/Transforms/CMakeLists.txt
+++ b/flang/lib/Optimizer/Transforms/CMakeLists.txt
@@ -10,8 +10,8 @@ add_flang_library(FIRTransforms
   ConstantArgumentGlobalisation.cpp
   ControlFlowConverter.cpp
   CUFAddConstructor.cpp
-  CufImplicitDeviceGlobal.cpp
-  CufOpConversion.cpp
+  CUFDeviceGlobal.cpp
+  CUFOpConversion.cpp
   ArrayValueCopy.cpp
   ExternalNameConversion.cpp
   MemoryUtils.cpp
diff --git a/flang/lib/Optimizer/Transforms/CufImplicitDeviceGlobal.cpp b/flang/lib/Optimizer/Transforms/CUFDeviceGlobal.cpp
similarity index 91%
rename from flang/lib/Optimizer/Transforms/CufImplicitDeviceGlobal.cpp
rename to flang/lib/Optimizer/Transforms/CUFDeviceGlobal.cpp
index 206400c2ef8e53..f182264bd90d78 100644
--- a/flang/lib/Optimizer/Transforms/CufImplicitDeviceGlobal.cpp
+++ b/flang/lib/Optimizer/Transforms/CUFDeviceGlobal.cpp
@@ -1,4 +1,4 @@
-//===-- CufOpConversion.cpp -----------------------------------------------===//
+//===-- CUFOpConversion.cpp -----------------------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -18,7 +18,7 @@
 #include "mlir/Transforms/DialectConversion.h"
 
 namespace fir {
-#define GEN_PASS_DEF_CUFIMPLICITDEVICEGLOBAL
+#define GEN_PASS_DEF_CUFDEVICEGLOBAL
 #include "flang/Optimizer/Transforms/Passes.h.inc"
 } // namespace fir
 
@@ -45,8 +45,8 @@ static void prepareImplicitDeviceGlobals(mlir::func::FuncOp funcOp,
   }
 }
 
-class CufImplicitDeviceGlobal
-    : public fir::impl::CufImplicitDeviceGlobalBase<CufImplicitDeviceGlobal> {
+class CUFDeviceGlobal
+    : public fir::impl::CUFDeviceGlobalBase<CUFDeviceGlobal> {
 public:
   void runOnOperation() override {
     mlir::Operation *op = getOperation();
diff --git a/flang/lib/Optimizer/Transforms/CufOpConversion.cpp b/flang/lib/Optimizer/Transforms/CUFOpConversion.cpp
similarity index 99%
rename from flang/lib/Optimizer/Transforms/CufOpConversion.cpp
rename to flang/lib/Optimizer/Transforms/CUFOpConversion.cpp
index 629f0c69f8cb5d..069d88e0afca47 100644
--- a/flang/lib/Optimizer/Transforms/CufOpConversion.cpp
+++ b/flang/lib/Optimizer/Transforms/CUFOpConversion.cpp
@@ -1,4 +1,4 @@
-//===-- CufOpConversion.cpp -----------------------------------------------===//
+//===-- CUFDeviceGlobal.cpp -----------------------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "flang/Optimizer/Transforms/CufOpConversion.h"
+#include "flang/Optimizer/Transforms/CUFOpConversion.h"
 #include "flang/Common/Fortran.h"
 #include "flang/Optimizer/Builder/Runtime/RTBuilder.h"
 #include "flang/Optimizer/CodeGen/TypeConverter.h"
@@ -619,7 +619,7 @@ struct CufDataTransferOpConversion
   const mlir::SymbolTable &symtab;
 };
 
-class CufOpConversion : public fir::impl::CufOpConversionBase<CufOpConversion> {
+class CUFOpConversion : public fir::impl::CUFOpConversionBase<CUFOpConversion> {
 public:
   void runOnOperation() override {
     auto *ctx = &getContext();
diff --git a/flang/test/Fir/CUDA/cuda-implicit-device-global.f90 b/flang/test/Fir/CUDA/cuda-implicit-device-global.f90
index c8bee3c62e6443..82a0c5948d9cb9 100644
--- a/flang/test/Fir/CUDA/cuda-implicit-device-global.f90
+++ b/flang/test/Fir/CUDA/cuda-implicit-device-global.f90
@@ -1,4 +1,4 @@
-// RUN: fir-opt --split-input-file --cuf-implicit-device-global %s | FileCheck %s
+// RUN: fir-opt --split-input-file --cuf-device-global %s | FileCheck %s
 
 // Test that global used in device function are flagged with the correct
 // attribute.

``````````

</details>


https://github.com/llvm/llvm-project/pull/113351


More information about the flang-commits mailing list