Skip to content

Commit 741a0a2

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:d9962c400f97 into amd-gfx:8bf360256d7b
Local branch amd-gfx 8bf3602 Merged main:50c298fd174f into amd-gfx:ed8d3fbeeabb Remote branch main d9962c4 [IR] Add disjoint flag for Or instructions. (llvm#72583)
2 parents 8bf3602 + d9962c4 commit 741a0a2

File tree

123 files changed

+1211
-185
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+1211
-185
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,8 @@ libclang
938938
--------
939939

940940
- Exposed arguments of ``clang::annotate``.
941+
- ``clang::getCursorKindForDecl`` now recognizes linkage specifications such as
942+
``extern "C"`` and reports them as ``CXCursor_LinkageSpec``.
941943

942944
Static Analyzer
943945
---------------

clang/include/clang/AST/OpenMPClause.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7776,10 +7776,10 @@ class OMPOrderClause final : public OMPClause {
77767776
/// \param MLoc Location of the modifier
77777777
OMPOrderClause(OpenMPOrderClauseKind A, SourceLocation ALoc,
77787778
SourceLocation StartLoc, SourceLocation LParenLoc,
7779-
SourceLocation EndLoc, OpenMPOrderClauseModifier M,
7779+
SourceLocation EndLoc, OpenMPOrderClauseModifier Modifier,
77807780
SourceLocation MLoc)
77817781
: OMPClause(llvm::omp::OMPC_order, StartLoc, EndLoc),
7782-
LParenLoc(LParenLoc), Kind(A), KindKwLoc(ALoc), Modifier(M),
7782+
LParenLoc(LParenLoc), Kind(A), KindKwLoc(ALoc), Modifier(Modifier),
77837783
ModifierKwLoc(MLoc) {}
77847784

77857785
/// Build an empty clause.

clang/lib/Sema/SemaCodeComplete.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4165,6 +4165,9 @@ CXCursorKind clang::getCursorKindForDecl(const Decl *D) {
41654165
case Decl::Concept:
41664166
return CXCursor_ConceptDecl;
41674167

4168+
case Decl::LinkageSpec:
4169+
return CXCursor_LinkageSpec;
4170+
41684171
default:
41694172
if (const auto *TD = dyn_cast<TagDecl>(D)) {
41704173
switch (TD->getTagKind()) {

clang/test/Index/recursive-cxx-member-calls.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,9 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) {
216216
// CHECK-tokens: Punctuation: "}" [4:63 - 4:64] ClassTemplate=pair:4:44 (Definition)
217217
// CHECK-tokens: Punctuation: ";" [4:64 - 4:65] Namespace=std:3:11 (Definition)
218218
// CHECK-tokens: Punctuation: "}" [5:1 - 5:2] Namespace=std:3:11 (Definition)
219-
// CHECK-tokens: Keyword: "extern" [6:1 - 6:7]
220-
// CHECK-tokens: Literal: ""C"" [6:8 - 6:11] UnexposedDecl=:6:8 (Definition)
221-
// CHECK-tokens: Punctuation: "{" [6:12 - 6:13] UnexposedDecl=:6:8 (Definition)
219+
// CHECK-tokens: Keyword: "extern" [6:1 - 6:7] LinkageSpec=:6:8 (Definition)
220+
// CHECK-tokens: Literal: ""C"" [6:8 - 6:11] LinkageSpec=:6:8 (Definition)
221+
// CHECK-tokens: Punctuation: "{" [6:12 - 6:13] LinkageSpec=:6:8 (Definition)
222222
// CHECK-tokens: Keyword: "int" [7:3 - 7:6] FunctionDecl=memcmp:7:7
223223
// CHECK-tokens: Identifier: "memcmp" [7:7 - 7:13] FunctionDecl=memcmp:7:7
224224
// CHECK-tokens: Punctuation: "(" [7:13 - 7:14] FunctionDecl=memcmp:7:7
@@ -232,7 +232,7 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) {
232232
// CHECK-tokens: Punctuation: "," [7:40 - 7:41] FunctionDecl=memcmp:7:7
233233
// CHECK-tokens: Identifier: "size_t" [7:42 - 7:48] TypeRef=size_t:2:25
234234
// CHECK-tokens: Punctuation: ")" [7:48 - 7:49] FunctionDecl=memcmp:7:7
235-
// CHECK-tokens: Punctuation: ";" [7:49 - 7:50] UnexposedDecl=:6:8 (Definition)
235+
// CHECK-tokens: Punctuation: ";" [7:49 - 7:50] LinkageSpec=:6:8 (Definition)
236236
// CHECK-tokens: Identifier: "size_t" [8:3 - 8:9] TypeRef=size_t:2:25
237237
// CHECK-tokens: Identifier: "strlen" [8:10 - 8:16] FunctionDecl=strlen:8:10
238238
// CHECK-tokens: Punctuation: "(" [8:16 - 8:17] FunctionDecl=strlen:8:10
@@ -1532,7 +1532,7 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) {
15321532
// CHECK: 4:20: TemplateTypeParameter=_T1:4:20 (Definition) Extent=[4:14 - 4:23]
15331533
// CHECK: 4:31: TemplateTypeParameter=_T2:4:31 (Definition) Extent=[4:25 - 4:34]
15341534
// CHECK: 4:55: FieldDecl=second:4:55 (Definition) Extent=[4:51 - 4:61]
1535-
// CHECK: 6:8: UnexposedDecl=:6:8 (Definition) Extent=[6:1 - 9:2]
1535+
// CHECK: 6:8: LinkageSpec=:6:8 (Definition) Extent=[6:1 - 9:2]
15361536
// CHECK: 7:7: FunctionDecl=memcmp:7:7 Extent=[7:3 - 7:49]
15371537
// CHECK: 7:26: ParmDecl=:7:26 (Definition) Extent=[7:14 - 7:26]
15381538
// CHECK: 7:40: ParmDecl=:7:40 (Definition) Extent=[7:28 - 7:40]

clang/tools/c-index-test/c-index-test.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1838,6 +1838,8 @@ static enum CXChildVisitResult PrintMangledName(CXCursor cursor, CXCursor p,
18381838
CXString MangledName;
18391839
if (clang_isUnexposed(clang_getCursorKind(cursor)))
18401840
return CXChildVisit_Recurse;
1841+
if (clang_getCursorKind(cursor) == CXCursor_LinkageSpec)
1842+
return CXChildVisit_Recurse;
18411843
PrintCursor(cursor, NULL);
18421844
MangledName = clang_Cursor_getMangling(cursor);
18431845
printf(" [mangled=%s]\n", clang_getCString(MangledName));
@@ -1853,6 +1855,8 @@ static enum CXChildVisitResult PrintManglings(CXCursor cursor, CXCursor p,
18531855
return CXChildVisit_Recurse;
18541856
if (!clang_isDeclaration(clang_getCursorKind(cursor)))
18551857
return CXChildVisit_Recurse;
1858+
if (clang_getCursorKind(cursor) == CXCursor_LinkageSpec)
1859+
return CXChildVisit_Recurse;
18561860
if (clang_getCursorKind(cursor) == CXCursor_ParmDecl)
18571861
return CXChildVisit_Continue;
18581862
PrintCursor(cursor, NULL);

flang/test/Driver/OpenMP/host-ir-flag.f90

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
!===----------------------------------------------------------------------===!
2+
! This directory can be used to add Integration tests involving multiple
3+
! stages of the compiler (for eg. from Fortran to LLVM IR). It should not
4+
! contain executable tests. We should only add tests here sparingly and only
5+
! if there is no other way to test. Repeat this message in each test that is
6+
! added to this directory and sub-directories.
7+
!===----------------------------------------------------------------------===!
8+
9+
!RUN: %flang_fc1 -emit-llvm-bc -fopenmp -o %t.bc %s 2>&1
10+
!RUN: %flang_fc1 -emit-mlir -fopenmp -fopenmp-is-target-device -fopenmp-host-ir-file-path %t.bc -o - %s 2>&1 | FileCheck %s
11+
12+
!CHECK: module attributes {{{.*}}, omp.host_ir_filepath = "{{.*}}.bc", omp.is_gpu = false, omp.is_target_device = true{{.*}}}
13+
subroutine omp_subroutine()
14+
end subroutine omp_subroutine

flang/test/Driver/OpenMP/map-types-and-sizes.f90 renamed to flang/test/Integration/OpenMP/map-types-and-sizes.f90

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
!===----------------------------------------------------------------------===!
2+
! This directory can be used to add Integration tests involving multiple
3+
! stages of the compiler (for eg. from Fortran to LLVM IR). It should not
4+
! contain executable tests. We should only add tests here sparingly and only
5+
! if there is no other way to test. Repeat this message in each test that is
6+
! added to this directory and sub-directories.
7+
!===----------------------------------------------------------------------===!
8+
19
!RUN: %flang_fc1 -emit-llvm -fopenmp -flang-deprecated-no-hlfir %s -o - | FileCheck %s
210

311
!===============================================================================
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
!===----------------------------------------------------------------------===!
2+
! This directory can be used to add Integration tests involving multiple
3+
! stages of the compiler (for eg. from Fortran to LLVM IR). It should not
4+
! contain executable tests. We should only add tests here sparingly and only
5+
! if there is no other way to test. Repeat this message in each test that is
6+
! added to this directory and sub-directories.
7+
!===----------------------------------------------------------------------===!
8+
9+
!RUN: %flang_fc1 -emit-llvm -fopenmp %s -o - | FileCheck %s --check-prefixes HOST,ALL
10+
!RUN: %flang_fc1 -emit-llvm -fopenmp -fopenmp-is-target-device %s -o - | FileCheck %s --check-prefixes DEVICE,ALL
11+
12+
!HOST: define {{.*}}@{{.*}}before{{.*}}(
13+
!DEVICE-NOT: define {{.*}}@before{{.*}}(
14+
!DEVICE-NOT: declare {{.*}}@before{{.*}}
15+
integer function before(x)
16+
integer, intent(in) :: x
17+
before = x + 200
18+
end function
19+
20+
!ALL: define {{.*}}@{{.*}}main{{.*}}(
21+
program main
22+
integer :: x, before, after
23+
!$omp target map(tofrom : x)
24+
x = 100
25+
!$omp end target
26+
!HOST: call {{.*}}@{{.*}}before{{.*}}(
27+
!DEVICE-NOT: call {{.*}}@before{{.*}}(
28+
!HOST: call {{.*}}@{{.*}}after{{.*}}(
29+
!DEVICE-NOT: call {{.*}}@after{{.*}}(
30+
x = x + before(x) + after(x)
31+
end program
32+
33+
!HOST: define {{.*}}@{{.*}}after{{.*}}(
34+
!DEVICE-NOT: define {{.*}}@after{{.*}}(
35+
!DEVICE-NOT: declare {{.*}}@after{{.*}}
36+
integer function after(x)
37+
integer, intent(in) :: x
38+
after = x + 300
39+
end function
40+
41+
!ALL: define {{.*}}@{{.*}}before_target{{.*}}(
42+
subroutine before_target(x)
43+
integer, intent(out) :: x
44+
!$omp target map(from: x)
45+
x = 1
46+
!$omp end target
47+
end subroutine
48+
49+
!ALL: define {{.*}}@{{.*}}middle{{.*}}(
50+
subroutine middle()
51+
integer :: x
52+
!$omp target map(from: x)
53+
x = 0
54+
!$omp end target
55+
!HOST: call {{.*}}@{{.*}}before_target{{.*}}(
56+
!DEVICE-NOT: call {{.*}}@{{.*}}before_target{{.*}}(
57+
!HOST: call {{.*}}@{{.*}}after_target{{.*}}(
58+
!DEVICE-NOT: call {{.*}}@{{.*}}after_target{{.*}}(
59+
call before_target(x)
60+
call after_target(x)
61+
end subroutine
62+
63+
!ALL: define {{.*}}@{{.*}}after_target{{.*}}(
64+
subroutine after_target(x)
65+
integer, intent(out) :: x
66+
!$omp target map(from:x)
67+
x = 2
68+
!$omp end target
69+
end subroutine

flang/test/Integration/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Flang Integration Tests
2+
3+
This directory can be used to add Integration tests involving multiple stages of the compiler (for eg. from Fortran to LLVM IR). It should not contain executable tests. We should only add tests here sparingly and only if there is no other way to test. Repeat this message in each test that is added to this directory and sub-directories.

libc/cmake/modules/compiler_features/check_float128.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "src/__support/macros/properties/compiler.h"
1+
#include "src/__support/macros/properties/float.h"
22

33
#ifndef LIBC_COMPILER_HAS_FLOAT128
44
#error unsupported

libc/docs/dev/code_style.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,12 @@ We define two kinds of macros:
4545
e.g., ``LIBC_TARGET_ARCH_IS_ARM``.
4646
* ``compiler.h`` - Host compiler properties.
4747
e.g., ``LIBC_COMPILER_IS_CLANG``.
48-
* ``cpu_features.h`` - Target cpu apu feature availability.
48+
* ``cpu_features.h`` - Target cpu feature availability.
4949
e.g., ``LIBC_TARGET_CPU_HAS_AVX2``.
50+
* ``float.h`` - Floating point type properties and availability.
51+
e.g., ``LIBC_COMPILER_HAS_FLOAT128``.
52+
* ``os.h`` - Target os properties.
53+
e.g., ``LIBC_TARGET_OS_IS_LINUX``.
5054

5155
* ``src/__support/macros/config.h`` - Important compiler and platform
5256
features. Such macros can be used to produce portable code by

libc/src/__support/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ add_header_library(
4242
.named_pair
4343
libc.src.__support.CPP.type_traits
4444
libc.src.__support.macros.attributes
45-
libc.src.__support.macros.properties.compiler
45+
libc.src.__support.macros.config
4646
)
4747

4848
add_header_library(

libc/src/__support/CPP/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,10 @@ add_header_library(
147147
type_traits/true_type.h
148148
type_traits/type_identity.h
149149
type_traits/void_t.h
150+
DEPENDS
151+
libc.src.__support.macros.attributes
152+
libc.src.__support.macros.config
153+
libc.src.__support.macros.properties.float
150154
)
151155

152156
add_header_library(

libc/src/__support/CPP/type_traits/is_floating_point.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include "src/__support/CPP/type_traits/is_same.h"
1212
#include "src/__support/CPP/type_traits/remove_cv.h"
1313
#include "src/__support/macros/attributes.h"
14-
#include "src/__support/macros/properties/compiler.h"
14+
#include "src/__support/macros/properties/float.h"
1515

1616
namespace LIBC_NAMESPACE::cpp {
1717

libc/src/__support/FPUtil/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ add_header_library(
2828
HDRS
2929
FloatProperties.h
3030
DEPENDS
31+
libc.src.__support.macros.properties.float
3132
libc.src.__support.uint128
3233
)
3334

libc/src/__support/FPUtil/FloatProperties.h

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,10 @@
1010
#define LLVM_LIBC_SRC___SUPPORT_FPUTIL_FLOATPROPERTIES_H
1111

1212
#include "src/__support/UInt128.h"
13-
#include "src/__support/macros/properties/architectures.h" // LIBC_TARGET_ARCH_XXX
13+
#include "src/__support/macros/properties/float.h" // LIBC_COMPILER_HAS_FLOAT128
1414

1515
#include <stdint.h>
1616

17-
// https://developer.arm.com/documentation/dui0491/i/C-and-C---Implementation-Details/Basic-data-types
18-
// https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms
19-
// https://docs.amd.com/bundle/HIP-Programming-Guide-v5.1/page/Programming_with_HIP.html
20-
#if defined(_WIN32) || defined(__arm__) || defined(__NVPTX__) || \
21-
defined(__AMDGPU__) || (defined(__APPLE__) && defined(__aarch64__))
22-
#define LONG_DOUBLE_IS_DOUBLE
23-
#endif
24-
25-
#if !defined(LONG_DOUBLE_IS_DOUBLE) && defined(LIBC_TARGET_ARCH_IS_X86)
26-
#define SPECIAL_X86_LONG_DOUBLE
27-
#endif
28-
2917
namespace LIBC_NAMESPACE {
3018
namespace fputil {
3119

libc/src/__support/macros/properties/CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,26 @@ add_header_library(
1010
compiler.h
1111
)
1212

13+
add_header_library(
14+
os
15+
HDRS
16+
os.h
17+
)
18+
1319
add_header_library(
1420
cpu_features
1521
HDRS
1622
cpu_features.h
1723
DEPENDS
1824
.architectures
1925
)
26+
27+
add_header_library(
28+
float
29+
HDRS
30+
float.h
31+
DEPENDS
32+
.architectures
33+
.compiler
34+
.os
35+
)

libc/src/__support/macros/properties/compiler.h

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,35 @@
99
#ifndef LLVM_LIBC_SRC___SUPPORT_MACROS_PROPERTIES_COMPILER_H
1010
#define LLVM_LIBC_SRC___SUPPORT_MACROS_PROPERTIES_COMPILER_H
1111

12+
// Example usage of compiler version checks
13+
// #if defined(LIBC_COMPILER_CLANG_VER)
14+
// # if LIBC_COMPILER_CLANG_VER < 1500
15+
// # warning "Libc only supports Clang 15 and later"
16+
// # endif
17+
// #elif defined(LIBC_COMPILER_GCC_VER)
18+
// # if LIBC_COMPILER_GCC_VER < 1500
19+
// # warning "Libc only supports GCC 15 and later"
20+
// # endif
21+
// #elif defined(LIBC_COMPILER_MSC_VER)
22+
// # if LIBC_COMPILER_MSC_VER < 1930
23+
// # warning "Libc only supports Visual Studio 2022 RTW (17.0) and later"
24+
// # endif
25+
// #endif
26+
1227
#if defined(__clang__)
1328
#define LIBC_COMPILER_IS_CLANG
29+
#define LIBC_COMPILER_CLANG_VER (__clang_major__ * 100 + __clang_minor__)
1430
#endif
1531

1632
#if defined(__GNUC__) && !defined(__clang__)
1733
#define LIBC_COMPILER_IS_GCC
34+
#define LIBC_COMPILER_GCC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
1835
#endif
1936

2037
#if defined(_MSC_VER)
2138
#define LIBC_COMPILER_IS_MSC
22-
#endif
23-
24-
// Check compiler features
25-
#if defined(FLT128_MANT_DIG)
26-
// C23 _Float128 type is available.
27-
#define LIBC_COMPILER_HAS_FLOAT128
28-
#define LIBC_FLOAT128_IS_C23
29-
using float128 = _Float128;
30-
31-
#elif defined(__SIZEOF_FLOAT128__)
32-
// Builtin __float128 is available.
33-
#define LIBC_COMPILER_HAS_FLOAT128
34-
#define LIBC_FLOAT128_IS_BUILTIN
35-
using float128 = __float128;
36-
37-
#elif (defined(__linux__) && defined(__aarch64__))
38-
// long double on Linux aarch64 is 128-bit floating point.
39-
#define LIBC_COMPILER_HAS_FLOAT128
40-
#define LIBC_FLOAT128_IS_LONG_DOUBLE
41-
using float128 = long double;
42-
39+
// https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros
40+
#define LIBC_COMPILER_MSC_VER (_MSC_VER)
4341
#endif
4442

4543
#endif // LLVM_LIBC_SRC___SUPPORT_MACROS_PROPERTIES_COMPILER_H

0 commit comments

Comments
 (0)