[clang] [flang] [flang][cuda][driver] Make sure flang does not switch to cc1 (PR #104613)

Valentin Clement バレンタイン クレメン via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 16 09:55:32 PDT 2024


https://github.com/clementval updated https://github.com/llvm/llvm-project/pull/104613

>From 36e18ae7bfa6fd2647da0b78bf2c332969b1091d Mon Sep 17 00:00:00 2001
From: Valentin Clement <clementval at gmail.com>
Date: Fri, 16 Aug 2024 09:23:29 -0700
Subject: [PATCH 1/2] [flang][cuda][driver] Make sure flang does not switch to
 cc1

---
 clang/lib/Driver/Types.cpp        | 3 +++
 flang/test/Driver/cuda-option.f90 | 7 ++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/Types.cpp b/clang/lib/Driver/Types.cpp
index 2b9b391c19c9fd..3de45b00b4d00f 100644
--- a/clang/lib/Driver/Types.cpp
+++ b/clang/lib/Driver/Types.cpp
@@ -170,6 +170,9 @@ bool types::isAcceptedByFlang(ID Id) {
   case TY_LLVM_IR:
   case TY_LLVM_BC:
     return true;
+  case TY_PP_CUDA:
+  case TY_CUDA:
+    return true;
   }
 }
 
diff --git a/flang/test/Driver/cuda-option.f90 b/flang/test/Driver/cuda-option.f90
index 562f8683b0ff7d..df45081711d8b0 100644
--- a/flang/test/Driver/cuda-option.f90
+++ b/flang/test/Driver/cuda-option.f90
@@ -1,5 +1,6 @@
 ! Test -fcuda option
 ! RUN: %flang_fc1 -cpp -x cuda -fdebug-unparse %s -o - | FileCheck %s
+! RUN: not %flang -cpp -x cuda %s -o - 2>&1 | FileCheck %s --check-prefix=MLIRERROR
 ! RUN: not %flang_fc1 -cpp %s -o - 2>&1 | FileCheck %s --check-prefix=ERROR
 program main
 #if _CUDA
@@ -12,4 +13,8 @@ program main
 ! CHECK: INTEGER :: var = 1
 ! CHECK: INTEGER, DEVICE :: dvar
 
-! ERROR: cuda-option.f90:8:19: error: expected end of statement
+! ERROR: cuda-option.f90:{{.*}}:{{.*}}: error: expected end of statement
+
+! The whole pipeline is not in place yet. It will currently fails at MLIR
+! translation level.
+! MLIRERROR: failed to legalize operation 'cuf.alloc'

>From 0e4f2c0a17a558ea55210601748ab45e3164f2a2 Mon Sep 17 00:00:00 2001
From: Valentin Clement <clementval at gmail.com>
Date: Fri, 16 Aug 2024 09:55:20 -0700
Subject: [PATCH 2/2] Fix typo

---
 flang/test/Driver/cuda-option.f90 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/flang/test/Driver/cuda-option.f90 b/flang/test/Driver/cuda-option.f90
index df45081711d8b0..591d7d070d3a85 100644
--- a/flang/test/Driver/cuda-option.f90
+++ b/flang/test/Driver/cuda-option.f90
@@ -15,6 +15,6 @@ program main
 
 ! ERROR: cuda-option.f90:{{.*}}:{{.*}}: error: expected end of statement
 
-! The whole pipeline is not in place yet. It will currently fails at MLIR
+! The whole pipeline is not in place yet. It will currently fail at MLIR
 ! translation level.
 ! MLIRERROR: failed to legalize operation 'cuf.alloc'



More information about the cfe-commits mailing list