[llvm-branch-commits] [flang] 6060731 - Revert "[flang][cuda][openacc] Emit an error when CUDA symbols are imported w…"

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Jun 22 21:53:15 PDT 2026


Author: Valentin Clement (バレンタイン クレメン)
Date: 2026-06-22T21:53:10-07:00
New Revision: 60607314f44bd4327e4e2fdf62b9d3d908b44ee2

URL: https://github.com/llvm/llvm-project/commit/60607314f44bd4327e4e2fdf62b9d3d908b44ee2
DIFF: https://github.com/llvm/llvm-project/commit/60607314f44bd4327e4e2fdf62b9d3d908b44ee2.diff

LOG: Revert "[flang][cuda][openacc] Emit an error when CUDA symbols are imported w…"

This reverts commit a6986f0b929d575728d564cd41bb0f9a6b6fdea4.

Added: 
    

Modified: 
    flang/lib/Semantics/mod-file.cpp

Removed: 
    flang/test/Semantics/modfile84.f90


################################################################################
diff  --git a/flang/lib/Semantics/mod-file.cpp b/flang/lib/Semantics/mod-file.cpp
index ac44f17009344..89a535c6ff6f9 100644
--- a/flang/lib/Semantics/mod-file.cpp
+++ b/flang/lib/Semantics/mod-file.cpp
@@ -11,7 +11,6 @@
 #include "flang/Common/restorer.h"
 #include "flang/Evaluate/tools.h"
 #include "flang/Parser/message.h"
-#include "flang/Parser/parse-tree-visitor.h"
 #include "flang/Parser/parsing.h"
 #include "flang/Parser/unparse.h"
 #include "flang/Semantics/scope.h"
@@ -73,7 +72,6 @@ static bool FileContentsMatch(
     const std::string &, const std::string &, const std::string &);
 static ModuleCheckSumType ComputeCheckSum(const std::string_view &);
 static std::string CheckSumString(ModuleCheckSumType);
-static bool ProgramHasCUDAAttrs(const parser::Program &);
 
 // Collect symbols needed for a subprogram interface
 class SubprogramSymbolCollector {
@@ -1705,13 +1703,6 @@ Scope *ModFileReader::Read(SourceName name, std::optional<bool> isIntrinsic,
     return nullptr;
   }
   parser::Program &parseTree{context_.SaveParseTree(std::move(*parsedProgram))};
-  if (context_.languageFeatures().IsEnabled(common::LanguageFeature::OpenACC) &&
-      !context_.languageFeatures().IsEnabled(common::LanguageFeature::CUDA) &&
-      ProgramHasCUDAAttrs(parseTree)) {
-    Say("use", name, ancestorName,
-        "CUDA is not enabled, but '%s' defines CUDA symbols"_err_en_US,
-        sourceFile->path());
-  }
   Scope *parentScope; // the scope this module/submodule goes into
   if (!isIntrinsic.has_value()) {
     for (const auto &dir : context_.intrinsicModuleDirectories()) {
@@ -1832,26 +1823,6 @@ static std::optional<SourceName> GetSubmoduleParent(
   }
 }
 
-struct CUDAAttrProgramVisitor {
-  template <typename A> bool Pre(const A &) { return true; }
-  template <typename A> void Post(const A &) {}
-  bool Pre(const common::CUDADataAttr &) {
-    foundCUDAAttrs = true;
-    return false;
-  }
-  bool Pre(const common::CUDASubprogramAttrs &) {
-    foundCUDAAttrs = true;
-    return false;
-  }
-  bool foundCUDAAttrs{false};
-};
-
-static bool ProgramHasCUDAAttrs(const parser::Program &program) {
-  CUDAAttrProgramVisitor visitor;
-  parser::Walk(program, visitor);
-  return visitor.foundCUDAAttrs;
-}
-
 void SubprogramSymbolCollector::Collect() {
   const auto &details{symbol_.get<SubprogramDetails>()};
   isInterface_ = details.isInterface();

diff  --git a/flang/test/Semantics/modfile84.f90 b/flang/test/Semantics/modfile84.f90
deleted file mode 100644
index 2abcd8083eea6..0000000000000
--- a/flang/test/Semantics/modfile84.f90
+++ /dev/null
@@ -1,17 +0,0 @@
-! RUN: split-file %s %t
-! RUN: %flang_fc1 -fsyntax-only -x cuda -module-dir %t %t/m.cuf
-! RUN: not %flang_fc1 -fsyntax-only -fopenacc -module-dir %t %t/use.f90 2>&1 | FileCheck %s
-
-!--- m.cuf
-module modfile84m
-  real, device :: d
-contains
-  attributes(device) subroutine s()
-  end subroutine
-end module
-
-!--- use.f90
-use modfile84m
-end
-
-! CHECK: error: Cannot use module file for module 'modfile84m': CUDA is not enabled, but '{{.*modfile84m.mod}}' defines CUDA symbols


        


More information about the llvm-branch-commits mailing list