Add patch from upstream and llvm-17 also to llvm-18

This commit is contained in:
Gianfranco Costamagna 2024-07-30 10:07:10 +02:00
parent 9979ab1993
commit c9102bbce4
2 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,56 @@
From: Emanuele Rocca <emanuele.rocca@arm.com>
Date: Fri, 19 Jul 2024 09:25:38 +0200
Subject: [PATCH] [Clang] make SVE types known to device targets too (#99446)
For the purpose of preprocessing and declarations in header files,
ensure clang accepts SVE types for both device and host targets.
Co-authored-by: Sander De Smalen <sander.desmalen@arm.com>
---
clang/lib/AST/ASTContext.cpp | 3 ++-
clang/lib/Sema/Sema.cpp | 4 +++-
clang/test/PCH/aarch64-sve-types.c | 2 ++
3 files changed, 7 insertions(+), 2 deletions(-)
Index: llvm-toolchain-17-17.0.6/clang/lib/AST/ASTContext.cpp
===================================================================
--- llvm-toolchain-17-17.0.6.orig/clang/lib/AST/ASTContext.cpp
+++ llvm-toolchain-17-17.0.6/clang/lib/AST/ASTContext.cpp
@@ -1353,7 +1353,8 @@ void ASTContext::InitBuiltinTypes(const
#include "clang/Basic/OpenCLExtensionTypes.def"
}
- if (Target.hasAArch64SVETypes()) {
+ if (Target.hasAArch64SVETypes() ||
+ (AuxTarget && AuxTarget->hasAArch64SVETypes())) {
#define SVE_TYPE(Name, Id, SingletonId) \
InitBuiltinType(SingletonId, BuiltinType::Id);
#include "clang/Basic/AArch64SVEACLETypes.def"
Index: llvm-toolchain-17-17.0.6/clang/lib/Sema/Sema.cpp
===================================================================
--- llvm-toolchain-17-17.0.6.orig/clang/lib/Sema/Sema.cpp
+++ llvm-toolchain-17-17.0.6/clang/lib/Sema/Sema.cpp
@@ -424,7 +424,9 @@ void Sema::Initialize() {
#include "clang/Basic/OpenCLExtensionTypes.def"
}
- if (Context.getTargetInfo().hasAArch64SVETypes()) {
+ if (Context.getTargetInfo().hasAArch64SVETypes() ||
+ (Context.getAuxTargetInfo() &&
+ Context.getAuxTargetInfo()->hasAArch64SVETypes())) {
#define SVE_TYPE(Name, Id, SingletonId) \
addImplicitTypedef(Name, Context.SingletonId);
#include "clang/Basic/AArch64SVEACLETypes.def"
Index: llvm-toolchain-17-17.0.6/clang/test/PCH/aarch64-sve-types.c
===================================================================
--- llvm-toolchain-17-17.0.6.orig/clang/test/PCH/aarch64-sve-types.c
+++ llvm-toolchain-17-17.0.6/clang/test/PCH/aarch64-sve-types.c
@@ -1,6 +1,8 @@
// RUN: %clang_cc1 -triple aarch64-linux-gnu -emit-pch -o %t %s
// RUN: %clang_cc1 -triple aarch64-linux-gnu -include-pch %t \
// RUN: -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -aux-triple aarch64-linux-gnu \
+// RUN: -x hip-cpp-output -emit-pch -o %t %s
// expected-no-diagnostics

View File

@ -154,3 +154,4 @@ ubuntu-releases.patch
clang-record-gcc-switches-by-default.patch clang-record-gcc-switches-by-default.patch
rename-libllvm.diff rename-libllvm.diff
link-with-package-metadata.diff link-with-package-metadata.diff
llvm-toolchain-17-sve-types-aux-target.diff