[clang] e6b9f12 - [flang][cuda][driver] Make sure flang does not switch to cc1 (#104613)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 16 11:56:26 PDT 2024
Author: Valentin Clement (バレンタイン クレメン)
Date: 2024-08-16T11:56:22-07:00
New Revision: e6b9f12b0ac0f1e6f7f7145719092c10731e4fe4
URL: https://github.com/llvm/llvm-project/commit/e6b9f12b0ac0f1e6f7f7145719092c10731e4fe4
DIFF: https://github.com/llvm/llvm-project/commit/e6b9f12b0ac0f1e6f7f7145719092c10731e4fe4.diff
LOG: [flang][cuda][driver] Make sure flang does not switch to cc1 (#104613)
Flang is switch to cc1 when we use `-x cuda`. Make sure we can use fc1
with cuda fortran input.
The current pipeline will fail at MLIR level for the moment.
#104483
Added:
Modified:
clang/lib/Driver/Types.cpp
flang/test/Driver/cuda-option.f90
Removed:
################################################################################
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..591d7d070d3a85 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 fail at MLIR
+! translation level.
+! MLIRERROR: failed to legalize operation 'cuf.alloc'
More information about the cfe-commits
mailing list