llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: None (pradt2)

<details>
<summary>Changes</summary>

This addresses issue #<!-- -->113094 

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


2 Files Affected:

- (modified) clang/lib/Sema/SemaType.cpp (+6-7) 
- (added) clang/test/Sema/bug113094.cpp (+6) 


``````````diff
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index 1fa5239a597c8..0c5cfdbba8d3d 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -8336,12 +8336,11 @@ static bool verifyValidIntegerConstantExpr(Sema &S, 
const ParsedAttr &Attr,
 /// match one of the standard Neon vector types.
 static void HandleNeonVectorTypeAttr(QualType &CurType, const ParsedAttr &Attr,
                                      Sema &S, VectorKind VecKind) {
-  bool IsTargetCUDAAndHostARM = false;
-  if (S.getLangOpts().CUDAIsDevice) {
-    const TargetInfo *AuxTI = S.getASTContext().getAuxTargetInfo();
-    IsTargetCUDAAndHostARM =
-        AuxTI && (AuxTI->getTriple().isAArch64() || 
AuxTI->getTriple().isARM());
-  }
+  const TargetInfo *AuxTI = S.getASTContext().getAuxTargetInfo();
+  bool IsArm = AuxTI && (AuxTI->getTriple().isAArch64() || 
AuxTI->getTriple().isARM());
+
+  bool IsTargetCUDAAndHostARM = IsArm && S.getLangOpts().CUDAIsDevice;
+  bool IsTargetOpenMPDeviceAndHostARM = IsArm && 
S.getLangOpts().OpenMPIsTargetDevice;
 
   // Target must have NEON (or MVE, whose vectors are similar enough
   // not to need a separate attribute)
@@ -8376,7 +8375,7 @@ static void HandleNeonVectorTypeAttr(QualType &CurType, 
const ParsedAttr &Attr,
 
   // Only certain element types are supported for Neon vectors.
   if (!isPermittedNeonBaseType(CurType, VecKind, S) &&
-      !IsTargetCUDAAndHostARM) {
+      !IsTargetCUDAAndHostARM && !IsTargetOpenMPDeviceAndHostARM) {
     S.Diag(Attr.getLoc(), diag::err_attribute_invalid_vector_type) << CurType;
     Attr.setInvalid();
     return;
diff --git a/clang/test/Sema/bug113094.cpp b/clang/test/Sema/bug113094.cpp
new file mode 100644
index 0000000000000..0900db9efb041
--- /dev/null
+++ b/clang/test/Sema/bug113094.cpp
@@ -0,0 +1,6 @@
+// RUN: %clang -fopenmp --offload-arch=sm_90 -nocudalib -target 
aarch64-unknown-linux-gnu -c -Xclang -verify %s
+// REQUIRES: aarch64-registered-target
+
+// expected-no-diagnostics
+
+typedef __attribute__ ((__neon_vector_type__ (4))) float __f32x4_t;

``````````

</details>


https://github.com/llvm/llvm-project/pull/127439
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to