Skip to content

[Clang][RISCV] Use Decl for checkRVVTypeSupport #65778

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 11, 2023

Conversation

eopXD
Copy link
Member

@eopXD eopXD commented Sep 8, 2023

Using ValueDecl will cause error for OpenMP. Decl should do the work.

@eopXD eopXD requested a review from a team as a code owner September 8, 2023 17:03
@github-actions github-actions bot added the clang:frontend Language frontend issues, e.g. anything involving "Sema" label Sep 8, 2023
@alexey-bataev
Copy link
Member

Need to add the test

@eopXD eopXD force-pushed the eop/fix-rvv-type-check branch from 559c8a2 to ebffa14 Compare September 8, 2023 17:56
@eopXD eopXD requested a review from a team as a code owner September 8, 2023 17:56
@eopXD eopXD force-pushed the eop/fix-rvv-type-check branch from ebffa14 to 8226aec Compare September 8, 2023 18:04
@jrtc27 jrtc27 requested a review from a team September 8, 2023 18:05
@eopXD eopXD force-pushed the eop/fix-rvv-type-check branch from 8226aec to 90764ba Compare September 8, 2023 18:06
Using ValueDecl will cause error for OpenMP. Decl should do the work.
@eopXD eopXD force-pushed the eop/fix-rvv-type-check branch from 90764ba to 91e607d Compare September 9, 2023 11:06
@eopXD eopXD requested a review from alexey-bataev September 9, 2023 11:06
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Sep 9, 2023
@llvmbot
Copy link
Member

llvmbot commented Sep 9, 2023

@llvm/pr-subscribers-clang

Changes

Using ValueDecl will cause error for OpenMP. Decl should do the work.

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

4 Files Affected:

  • (modified) clang/include/clang/Sema/Sema.h (+1-1)
  • (modified) clang/lib/Sema/SemaChecking.cpp (+1-1)
  • (modified) clang/lib/Sema/SemaDecl.cpp (+1-1)
  • (added) clang/test/SemaOpenMP/riscv-vector-with-openmp.c (+12)
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 4fd0e6bd5982a71..5c7207062741b52 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -13726,7 +13726,7 @@ class Sema final {
   bool CheckRISCVLMUL(CallExpr *TheCall, unsigned ArgNum);
   bool CheckRISCVBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
                                      CallExpr *TheCall);
-  void checkRVVTypeSupport(QualType Ty, SourceLocation Loc, ValueDecl *D);
+  void checkRVVTypeSupport(QualType Ty, SourceLocation Loc, Decl *D);
   bool CheckLoongArchBuiltinFunctionCall(const TargetInfo &TI,
                                          unsigned BuiltinID, CallExpr *TheCall);
   bool CheckWebAssemblyBuiltinFunctionCall(const TargetInfo &TI,
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 3932d9cd07d9864..3b4ac613da76aa8 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -5514,7 +5514,7 @@ bool Sema::CheckWebAssemblyBuiltinFunctionCall(const TargetInfo &TI,
   return false;
 }
 
-void Sema::checkRVVTypeSupport(QualType Ty, SourceLocation Loc, ValueDecl *D) {
+void Sema::checkRVVTypeSupport(QualType Ty, SourceLocation Loc, Decl *D) {
   const TargetInfo &TI = Context.getTargetInfo();
   // (ELEN, LMUL) pairs of (8, mf8), (16, mf4), (32, mf2), (64, m1) requires at
   // least zve64x
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index d6e090ee496eb30..37060f668b7acf3 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -8866,7 +8866,7 @@ void Sema::CheckVariableDeclarationType(VarDecl *NewVD) {
   }
 
   if (T->isRVVType())
-    checkRVVTypeSupport(T, NewVD->getLocation(), cast(CurContext));
+    checkRVVTypeSupport(T, NewVD->getLocation(), cast(CurContext));
 }
 
 /// Perform semantic checking on a newly-created variable
diff --git a/clang/test/SemaOpenMP/riscv-vector-with-openmp.c b/clang/test/SemaOpenMP/riscv-vector-with-openmp.c
new file mode 100644
index 000000000000000..5dae3eb9ce0b0a2
--- /dev/null
+++ b/clang/test/SemaOpenMP/riscv-vector-with-openmp.c
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -triple riscv64 -target-feature +v -fsyntax-only \
+// RUN: -verify -fopenmp %s
+// REQUIRES: riscv-registered-target
+
+// expected-no-diagnostics
+
+void foo() {
+  #pragma omp parallel
+  {
+    __rvv_int32m1_t i32m1;
+  }
+}

Copy link
Member

@alexey-bataev alexey-bataev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG

@eopXD
Copy link
Member Author

eopXD commented Sep 9, 2023

@jrtc27 Anymore comments before merging this?

@eopXD eopXD requested a review from jrtc27 September 10, 2023 15:12
@eopXD eopXD merged commit 77b7b1a into llvm:main Sep 11, 2023
ZijunZhaoCCK pushed a commit to ZijunZhaoCCK/llvm-project that referenced this pull request Sep 19, 2023
Using ValueDecl will cause error for OpenMP. Decl should do the work.
@eopXD eopXD deleted the eop/fix-rvv-type-check branch September 22, 2023 06:23
fanghuaqi pushed a commit to riscv-mcu/llvm-project that referenced this pull request Oct 7, 2023
Using ValueDecl will cause error for OpenMP. Decl should do the work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:RISC-V clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants