Skip to content

Commit aae7258

Browse files
committed
Merge branch 'users/meinersbur/flang_runtime_move-files' into users/meinersbur/flang_runtime
2 parents 08f5e1f + d512ee0 commit aae7258

File tree

232 files changed

+5925
-2289
lines changed

Some content is hidden

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

232 files changed

+5925
-2289
lines changed

.github/workflows/libc-fullbuild-tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18+
build_type: [Debug, Release, MinSizeRel]
1819
include:
1920
- os: ubuntu-24.04
2021
ccache-variant: sccache
@@ -68,7 +69,7 @@ jobs:
6869
cmake -B ${{ steps.strings.outputs.build-output-dir }}
6970
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
7071
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
71-
-DCMAKE_BUILD_TYPE=MinSizeRel
72+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
7273
-DCMAKE_C_COMPILER_LAUNCHER=${{ matrix.ccache-variant }}
7374
-DCMAKE_CXX_COMPILER_LAUNCHER=${{ matrix.ccache-variant }}
7475
-DCMAKE_INSTALL_PREFIX=${{ steps.strings.outputs.build-install-dir }}

.github/workflows/libc-overlay-tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations.
1717
fail-fast: false
1818
matrix:
19+
build_type: [Debug, Release, MinSizeRel]
1920
include:
2021
# TODO: add linux gcc when it is fixed
2122
- os: ubuntu-24.04
@@ -95,7 +96,7 @@ jobs:
9596
cmake -B ${{ steps.strings.outputs.build-output-dir }}
9697
-DCMAKE_CXX_COMPILER=${{ matrix.compiler.cpp_compiler }}
9798
-DCMAKE_C_COMPILER=${{ matrix.compiler.c_compiler }}
98-
-DCMAKE_BUILD_TYPE=MinSizeRel
99+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
99100
-DCMAKE_C_COMPILER_LAUNCHER=${{ matrix.ccache-variant }}
100101
-DCMAKE_CXX_COMPILER_LAUNCHER=${{ matrix.ccache-variant }}
101102
-DCMAKE_POLICY_DEFAULT_CMP0141=NEW

.github/workflows/premerge.yaml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,16 @@ on:
2121
- 'main'
2222
- 'release/**'
2323

24+
concurrency:
25+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
26+
cancel-in-progress: true
27+
2428
jobs:
2529
premerge-checks-linux:
2630
if: >-
2731
github.repository_owner == 'llvm' &&
2832
(github.event_name != 'pull_request' || github.event.action != 'closed')
2933
runs-on: llvm-premerge-linux-runners
30-
concurrency:
31-
group: ${{ github.workflow }}-linux-${{ github.event.pull_request.number || github.sha }}
32-
cancel-in-progress: true
3334
steps:
3435
- name: Checkout LLVM
3536
uses: actions/checkout@v4
@@ -88,9 +89,6 @@ jobs:
8889
github.repository_owner == 'llvm' &&
8990
(github.event_name != 'pull_request' || github.event.action != 'closed')
9091
runs-on: llvm-premerge-windows-runners
91-
concurrency:
92-
group: ${{ github.workflow }}-windows-${{ github.event.pull_request.number || github.sha }}
93-
cancel-in-progress: true
9492
defaults:
9593
run:
9694
shell: bash
@@ -148,9 +146,6 @@ jobs:
148146
149147
permerge-check-macos:
150148
runs-on: macos-14
151-
concurrency:
152-
group: ${{ github.workflow }}-macos-${{ github.event.pull_request.number || github.sha }}
153-
cancel-in-progress: true
154149
if: >-
155150
github.repository_owner == 'llvm' &&
156151
(startswith(github.ref_name, 'release/') ||
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# This file sets up a CMakeCache for the second stage of a Fuchsia toolchain build.
2+
3+
include(${CMAKE_CURRENT_LIST_DIR}/Fuchsia-stage2.cmake)
4+
5+
if(NOT APPLE)
6+
set(BOOTSTRAP_LLVM_ENABLE_LLD ON CACHE BOOL "")
7+
endif()
8+
9+
set(CLANG_BOOTSTRAP_TARGETS
10+
check-all
11+
check-clang
12+
check-lld
13+
check-llvm
14+
clang
15+
clang-test-depends
16+
toolchain-distribution
17+
install-toolchain-distribution
18+
install-toolchain-distribution-stripped
19+
install-toolchain-distribution-toolchain
20+
lld-test-depends
21+
llvm-config
22+
llvm-test-depends
23+
test-depends
24+
test-suite CACHE STRING "")
25+
26+
get_cmake_property(variableNames VARIABLES)
27+
foreach(variableName ${variableNames})
28+
if(variableName MATCHES "^STAGE2_")
29+
string(REPLACE "STAGE2_" "" new_name ${variableName})
30+
list(APPEND EXTRA_ARGS "-D${new_name}=${${variableName}}")
31+
endif()
32+
endforeach()
33+
34+
set(CLANG_PGO_TRAINING_DEPS
35+
builtins
36+
runtimes
37+
CACHE STRING "")
38+
39+
# Setup the bootstrap build.
40+
set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
41+
set(CLANG_BOOTSTRAP_CMAKE_ARGS
42+
${EXTRA_ARGS}
43+
-C ${CMAKE_CURRENT_LIST_DIR}/Fuchsia-stage2.cmake
44+
CACHE STRING "")

clang/cmake/caches/Fuchsia.cmake

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,16 @@ else()
126126
set(LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
127127
set(LIBCXX_HARDENING_MODE "none" CACHE STRING "")
128128
set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
129+
set(COMPILER_RT_BUILD_LIBFUZZER OFF CACHE BOOL "")
130+
set(COMPILER_RT_BUILD_PROFILE ON CACHE BOOL "")
131+
set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "")
132+
set(COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "")
133+
set(COMPILER_RT_USE_BUILTINS_LIBRARY ON CACHE BOOL "")
134+
set(COMPILER_RT_DEFAULT_TARGET_ONLY ON CACHE BOOL "")
135+
set(SANITIZER_CXX_ABI "libc++" CACHE STRING "")
136+
set(SANITIZER_CXX_ABI_INTREE ON CACHE BOOL "")
137+
set(SANITIZER_TEST_CXX "libc++" CACHE STRING "")
138+
set(SANITIZER_TEST_CXX_INTREE ON CACHE BOOL "")
129139
set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "")
130140
set(RUNTIMES_CMAKE_ARGS "-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13;-DCMAKE_OSX_ARCHITECTURES=arm64|x86_64" CACHE STRING "")
131141
endif()
@@ -164,34 +174,29 @@ endif()
164174

165175
set(BOOTSTRAP_LLVM_ENABLE_LLD ON CACHE BOOL "")
166176
set(BOOTSTRAP_LLVM_ENABLE_LTO ON CACHE BOOL "")
177+
set(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED ON CACHE BOOL "")
167178

168179
set(_FUCHSIA_BOOTSTRAP_TARGETS
169-
check-all
170-
check-clang
171-
check-lld
172-
check-llvm
173-
check-polly
174-
llvm-config
175-
clang-test-depends
176-
lld-test-depends
177-
llvm-test-depends
178-
test-suite
179-
test-depends
180-
toolchain-distribution
181-
install-toolchain-distribution
182-
install-toolchain-distribution-stripped
183-
install-toolchain-distribution-toolchain
184-
clang)
180+
generate-profdata
181+
stage2
182+
stage2-toolchain-distribution
183+
stage2-install-toolchain-distribution
184+
stage2-install-toolchain-distribution-stripped
185+
stage2-install-toolchain-distribution-toolchain
186+
stage2-check-all
187+
stage2-check-lld
188+
stage2-check-llvm
189+
stage2-check-clang
190+
stage2-test-suite)
185191

186192
if(FUCHSIA_ENABLE_LLDB)
187193
list(APPEND _FUCHSIA_ENABLE_PROJECTS lldb)
188194
list(APPEND _FUCHSIA_BOOTSTRAP_TARGETS
189-
check-lldb
190-
lldb-test-depends
191-
debugger-distribution
192-
install-debugger-distribution
193-
install-debugger-distribution-stripped
194-
install-debugger-distribution-toolchain)
195+
stage2-check-lldb
196+
stage2-debugger-distribution
197+
stage2-install-debugger-distribution
198+
stage2-install-debugger-distribution-stripped
199+
stage2-install-debugger-distribution-toolchain)
195200
endif()
196201

197202
set(LLVM_ENABLE_PROJECTS ${_FUCHSIA_ENABLE_PROJECTS} CACHE STRING "")
@@ -200,6 +205,7 @@ set(CLANG_BOOTSTRAP_TARGETS ${_FUCHSIA_BOOTSTRAP_TARGETS} CACHE STRING "")
200205
get_cmake_property(variableNames VARIABLES)
201206
foreach(variableName ${variableNames})
202207
if(variableName MATCHES "^STAGE2_")
208+
list(APPEND EXTRA_ARGS "-D${variableName}=${${variableName}}")
203209
string(REPLACE "STAGE2_" "" new_name ${variableName})
204210
string(REPLACE ";" "|" value "${${variableName}}")
205211
list(APPEND EXTRA_ARGS "-D${new_name}=${value}")
@@ -209,6 +215,9 @@ endforeach()
209215
# TODO: This is a temporary workaround until we figure out the right solution.
210216
set(BOOTSTRAP_LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "")
211217

218+
set(LLVM_BUILTIN_TARGETS "default" CACHE STRING "")
219+
set(LLVM_RUNTIME_TARGETS "default" CACHE STRING "")
220+
212221
# Setup the bootstrap build.
213222
set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
214223
set(CLANG_BOOTSTRAP_EXTRA_DEPS
@@ -217,5 +226,5 @@ set(CLANG_BOOTSTRAP_EXTRA_DEPS
217226
CACHE STRING "")
218227
set(CLANG_BOOTSTRAP_CMAKE_ARGS
219228
${EXTRA_ARGS}
220-
-C ${CMAKE_CURRENT_LIST_DIR}/Fuchsia-stage2.cmake
229+
-C ${CMAKE_CURRENT_LIST_DIR}/Fuchsia-stage2-instrumented.cmake
221230
CACHE STRING "")

clang/docs/BoundsSafety.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,8 @@ that has the define.
959959
#if defined(__has_feature) && __has_feature(bounds_safety)
960960
#define __counted_by(T) __attribute__((__counted_by__(T)))
961961
// ... other bounds annotations
962-
#else #define __counted_by(T) // defined as nothing
962+
#else
963+
#define __counted_by(T) // defined as nothing
963964
// ... other bounds annotations
964965
#endif
965966
@@ -987,7 +988,7 @@ and it does not guarantee other types of memory safety properties. Consequently,
987988
it may not prevent some of the secondary bounds safety violations caused by
988989
other types of safety violations such as type confusion. For instance,
989990
``-fbounds-safety`` does not perform type-safety checks on conversions between
990-
`__single`` pointers of different pointee types (e.g., ``char *__single`` →
991+
``__single`` pointers of different pointee types (e.g., ``char *__single`` →
991992
``void *__single`` → ``int *__single``) beyond what the foundation languages
992993
(C/C++) already offer.
993994

@@ -1003,4 +1004,4 @@ Try it out
10031004

10041005
Your feedback on the programming model is valuable. You may want to follow the
10051006
instruction in :doc:`BoundsSafetyAdoptionGuide` to play with ``-fbounds-safety``
1006-
and please send your feedback to `Yeoul Na <mailto:[email protected]>`_.
1007+
and please send your feedback to `Yeoul Na <mailto:[email protected]>`_.

clang/docs/OpenMPSupport.rst

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -416,9 +416,9 @@ implementation.
416416
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
417417
| safe_sync and progress with identifier and API | :none:`unclaimed` | :none:`unclaimed` | |
418418
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
419-
| OpenMP directives in concurrent loop regions | :none:`unclaimed` | :none:`unclaimed` | |
419+
| OpenMP directives in concurrent loop regions | :good:`done` | :none:`unclaimed` | https://github.com/llvm/llvm-project/pull/125621 |
420420
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
421-
| atomics constructs on concurrent loop regions | :none:`unclaimed` | :none:`unclaimed` | |
421+
| atomics constructs on concurrent loop regions | :good:`done` | :none:`unclaimed` | https://github.com/llvm/llvm-project/pull/125621 |
422422
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
423423
| Loop construct with DO CONCURRENT | :none:`unclaimed` | :none:`unclaimed` | |
424424
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
@@ -456,9 +456,7 @@ implementation.
456456
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
457457
| map-type modifiers in arbitrary position | :none:`unclaimed` | :none:`unclaimed` | |
458458
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
459-
| atomic constructs in loop region | :none:`unclaimed` | :none:`unclaimed` | |
460-
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
461-
| Lift nesting restriction on concurrent loop | :none:`unclaimed` | :none:`unclaimed` | |
459+
| Lift nesting restriction on concurrent loop | :good:`done` | :none:`unclaimed` | https://github.com/llvm/llvm-project/pull/125621 |
462460
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
463461
| priority clause for target constructs | :none:`unclaimed` | :none:`unclaimed` | |
464462
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+

clang/include/clang/AST/DeclTemplate.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1960,6 +1960,8 @@ class ClassTemplateSpecializationDecl : public CXXRecordDecl,
19601960

19611961
bool hasStrictPackMatch() const { return StrictPackMatch; }
19621962

1963+
void setStrictPackMatch(bool Val) { StrictPackMatch = Val; }
1964+
19631965
/// Get the point of instantiation (if any), or null if none.
19641966
SourceLocation getPointOfInstantiation() const {
19651967
return PointOfInstantiation;

clang/include/clang/AST/OperationKinds.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,9 @@ CAST_OPERATION(HLSLVectorTruncation)
367367
// Non-decaying array RValue cast (HLSL only).
368368
CAST_OPERATION(HLSLArrayRValue)
369369

370+
// Aggregate by Value cast (HLSL only).
371+
CAST_OPERATION(HLSLElementwiseCast)
372+
370373
//===- Binary Operations -------------------------------------------------===//
371374
// Operators listed in order of precedence.
372375
// Note that additions to this should also update the StmtVisitor class,

clang/include/clang/ASTMatchers/ASTMatchers.h

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2489,7 +2489,28 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, FloatingLiteral>
24892489
extern const internal::VariadicDynCastAllOfMatcher<Stmt, ImaginaryLiteral>
24902490
imaginaryLiteral;
24912491

2492-
/// Matches fixed point literals
2492+
/// Matches fixed-point literals eg.
2493+
/// 0.5r, 0.5hr, 0.5lr, 0.5uhr, 0.5ur, 0.5ulr
2494+
/// 1.0k, 1.0hk, 1.0lk, 1.0uhk, 1.0uk, 1.0ulk
2495+
/// Exponents 1.0e10k
2496+
/// Hexadecimal numbers 0x0.2p2r
2497+
///
2498+
/// Does not match implicit conversions such as first two lines:
2499+
/// \code
2500+
/// short _Accum sa = 2;
2501+
/// _Accum a = 12.5;
2502+
/// _Accum b = 1.25hk;
2503+
/// _Fract c = 0.25hr;
2504+
/// _Fract v = 0.35uhr;
2505+
/// _Accum g = 1.45uhk;
2506+
/// _Accum decexp1 = 1.575e1k;
2507+
/// \endcode
2508+
/// \compile_args{-ffixed-point;-std=c99}
2509+
///
2510+
/// The matcher \matcher{fixedPointLiteral()} matches
2511+
/// \match{1.25hk}, \match{0.25hr}, \match{0.35uhr},
2512+
/// \match{1.45uhk}, \match{1.575e1k}, but does not
2513+
/// match \nomatch{12.5} and \nomatch{2} from the code block.
24932514
extern const internal::VariadicDynCastAllOfMatcher<Stmt, FixedPointLiteral>
24942515
fixedPointLiteral;
24952516

clang/include/clang/ExtractAPI/ExtractAPIVisitor.h

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1146,11 +1146,29 @@ bool ExtractAPIVisitorBase<Derived>::VisitTypedefNameDecl(
11461146

11471147
StringRef Name = Decl->getName();
11481148

1149+
auto nameMatches = [&Name](TagDecl *TagDecl) {
1150+
StringRef TagName = TagDecl->getName();
1151+
1152+
if (TagName == Name)
1153+
return true;
1154+
1155+
// Also check whether the tag decl's name is the same as the typedef name
1156+
// with prefixed underscores
1157+
if (TagName.starts_with('_')) {
1158+
StringRef StrippedName = TagName.ltrim('_');
1159+
1160+
if (StrippedName == Name)
1161+
return true;
1162+
}
1163+
1164+
return false;
1165+
};
1166+
11491167
// If the underlying type was defined as part of the typedef modify it's
11501168
// fragments directly and pretend the typedef doesn't exist.
11511169
if (auto *TagDecl = Decl->getUnderlyingType()->getAsTagDecl()) {
11521170
if (TagDecl->isEmbeddedInDeclarator() && TagDecl->isCompleteDefinition() &&
1153-
Decl->getName() == TagDecl->getName()) {
1171+
nameMatches(TagDecl)) {
11541172
SmallString<128> TagUSR;
11551173
index::generateUSRForDecl(TagDecl, TagUSR);
11561174
if (auto *Record = API.findRecordForUSR(TagUSR)) {
@@ -1164,6 +1182,11 @@ bool ExtractAPIVisitorBase<Derived>::VisitTypedefNameDecl(
11641182
.append(Name, DeclarationFragments::FragmentKind::Identifier)
11651183
.appendSemicolon();
11661184

1185+
// Replace the name and subheading in case it's underscored so we can
1186+
// use the non-underscored version
1187+
Record->Name = Name;
1188+
Record->SubHeading = DeclarationFragmentsBuilder::getSubHeading(Decl);
1189+
11671190
return true;
11681191
}
11691192
}

clang/include/clang/Sema/SemaHLSL.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ class SemaHLSL : public SemaBase {
141141
// Diagnose whether the input ID is uint/unit2/uint3 type.
142142
bool diagnoseInputIDType(QualType T, const ParsedAttr &AL);
143143

144+
bool CanPerformScalarCast(QualType SrcTy, QualType DestTy);
145+
bool ContainsBitField(QualType BaseTy);
146+
bool CanPerformElementwiseCast(Expr *Src, QualType DestType);
144147
ExprResult ActOnOutParamExpr(ParmVarDecl *Param, Expr *Arg);
145148

146149
QualType getInoutParameterType(QualType Ty);

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6234,9 +6234,6 @@ bool Compiler<Emitter>::visitDeclRef(const ValueDecl *D, const Expr *E) {
62346234

62356235
return this->emitGetPtrParam(It->second.Offset, E);
62366236
}
6237-
6238-
if (D->getType()->isReferenceType())
6239-
return this->emitDummyPtr(D, E);
62406237
}
62416238

62426239
// In case we need to re-visit a declaration.

clang/lib/AST/Expr.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1956,6 +1956,7 @@ bool CastExpr::CastConsistency() const {
19561956
case CK_FixedPointToBoolean:
19571957
case CK_HLSLArrayRValue:
19581958
case CK_HLSLVectorTruncation:
1959+
case CK_HLSLElementwiseCast:
19591960
CheckNoBasePath:
19601961
assert(path_empty() && "Cast kind should not have a base path!");
19611962
break;

clang/lib/AST/ExprConstant.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15047,6 +15047,7 @@ bool IntExprEvaluator::VisitCastExpr(const CastExpr *E) {
1504715047
case CK_NoOp:
1504815048
case CK_LValueToRValueBitCast:
1504915049
case CK_HLSLArrayRValue:
15050+
case CK_HLSLElementwiseCast:
1505015051
return ExprEvaluatorBaseTy::VisitCastExpr(E);
1505115052

1505215053
case CK_MemberPointerToBoolean:
@@ -15905,6 +15906,7 @@ bool ComplexExprEvaluator::VisitCastExpr(const CastExpr *E) {
1590515906
case CK_IntegralToFixedPoint:
1590615907
case CK_MatrixCast:
1590715908
case CK_HLSLVectorTruncation:
15909+
case CK_HLSLElementwiseCast:
1590815910
llvm_unreachable("invalid cast kind for complex value");
1590915911

1591015912
case CK_LValueToRValue:

0 commit comments

Comments
 (0)