[clang] Clang/bug113094 (PR #127439)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Feb 16 21:57:31 PST 2025
https://github.com/pradt2 created https://github.com/llvm/llvm-project/pull/127439
This addresses issue #113094
>From cfea7537eea19c4cff89d1e2a35dff2caff00106 Mon Sep 17 00:00:00 2001
From: pradt2 <12902844+pradt2 at users.noreply.github.com>
Date: Sun, 16 Feb 2025 00:22:42 -0800
Subject: [PATCH 1/3] [clang]: fix __neon_vector__type support when using
OpenMP offloading
---
clang/lib/Sema/SemaType.cpp | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index 1fa5239a597c8..5efcceddc78f9 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->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;
>From c50c5a9a6bc043037428630afbc160f8c580eb1d Mon Sep 17 00:00:00 2001
From: pradt2 <12902844+pradt2 at users.noreply.github.com>
Date: Sun, 16 Feb 2025 00:54:52 -0800
Subject: [PATCH 2/3] [clang]: fix __neon_vector__type support when using
OpenMP offloading
---
clang/lib/Sema/SemaType.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index 5efcceddc78f9..0c5cfdbba8d3d 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -8337,7 +8337,7 @@ static bool verifyValidIntegerConstantExpr(Sema &S, const ParsedAttr &Attr,
static void HandleNeonVectorTypeAttr(QualType &CurType, const ParsedAttr &Attr,
Sema &S, VectorKind VecKind) {
const TargetInfo *AuxTI = S.getASTContext().getAuxTargetInfo();
- bool IsArm = AuxTI->getTriple().isAArch64() || AuxTI->getTriple().isARM();
+ bool IsArm = AuxTI && (AuxTI->getTriple().isAArch64() || AuxTI->getTriple().isARM());
bool IsTargetCUDAAndHostARM = IsArm && S.getLangOpts().CUDAIsDevice;
bool IsTargetOpenMPDeviceAndHostARM = IsArm && S.getLangOpts().OpenMPIsTargetDevice;
>From 55e4d444572da286fdd4218178c6bc03c3e56b5b Mon Sep 17 00:00:00 2001
From: pradt2 <12902844+pradt2 at users.noreply.github.com>
Date: Sun, 16 Feb 2025 01:51:12 -0800
Subject: [PATCH 3/3] [clang]: fix __neon_vector__type support when using
OpenMP offloading
---
clang/test/Sema/bug113094.cpp | 6 ++++++
1 file changed, 6 insertions(+)
create mode 100644 clang/test/Sema/bug113094.cpp
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;
More information about the cfe-commits
mailing list