Skip to content

Commit c716e64

Browse files
authored
Merge branch 'main' into hliao/main/fix-cir-dependency
2 parents 0073376 + 0735537 commit c716e64

File tree

380 files changed

+5475
-3370
lines changed

Some content is hidden

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

380 files changed

+5475
-3370
lines changed

.ci/compute-projects.sh

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,14 @@ function compute-projects-to-test() {
1818
shift
1919
projects=${@}
2020
for project in ${projects}; do
21-
echo "${project}"
2221
case ${project} in
2322
lld)
24-
for p in bolt cross-project-tests; do
23+
for p in lld bolt cross-project-tests; do
2524
echo $p
2625
done
2726
;;
2827
llvm)
29-
for p in bolt clang clang-tools-extra lld lldb mlir polly; do
28+
for p in llvm bolt clang clang-tools-extra lld lldb mlir polly; do
3029
echo $p
3130
done
3231
# Flang is not stable in Windows CI at the moment
@@ -36,21 +35,30 @@ function compute-projects-to-test() {
3635
;;
3736
clang)
3837
# lldb is temporarily removed to alleviate Linux pre-commit CI waiting times
39-
for p in clang-tools-extra compiler-rt cross-project-tests; do
38+
for p in clang clang-tools-extra compiler-rt cross-project-tests; do
4039
echo $p
4140
done
4241
;;
4342
clang-tools-extra)
44-
echo libc
43+
for p in clang-tools-extra libc; do
44+
echo $p
45+
done
4546
;;
4647
mlir)
48+
echo mlir
49+
# Flang is not stable in Windows CI at the moment
50+
if [[ $isForWindows == 0 ]]; then
51+
echo flang
52+
fi
53+
;;
54+
flang-rt)
4755
# Flang is not stable in Windows CI at the moment
4856
if [[ $isForWindows == 0 ]]; then
4957
echo flang
5058
fi
5159
;;
5260
*)
53-
# Nothing to do
61+
echo "${project}"
5462
;;
5563
esac
5664
done
@@ -65,6 +73,11 @@ function compute-runtimes-to-test() {
6573
echo $p
6674
done
6775
;;
76+
flang)
77+
for p in flang-rt; do
78+
echo $p
79+
done
80+
;;
6881
*)
6982
# Nothing to do
7083
;;

.ci/generate-buildkite-pipeline-premerge

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ fi
7373
# needs while letting them run on the infrastructure provided by LLVM.
7474

7575
# Figure out which projects need to be built on each platform
76-
all_projects="bolt clang clang-tools-extra compiler-rt cross-project-tests flang libc libclc lld lldb llvm mlir openmp polly pstl"
76+
all_projects="bolt clang clang-tools-extra compiler-rt cross-project-tests flang flang-rt libc libclc lld lldb llvm mlir openmp polly pstl"
7777
modified_projects="$(keep-modified-projects ${all_projects})"
7878

7979
linux_projects_to_test=$(exclude-linux $(compute-projects-to-test 0 ${modified_projects}))

.ci/metrics/metrics.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,24 @@ def github_get_metrics(
168168
created_at = job.created_at
169169
started_at = job.started_at
170170
completed_at = job.completed_at
171-
queue_time = started_at - created_at
172-
run_time = completed_at - started_at
171+
172+
# GitHub API can return results where the started_at is slightly
173+
# later then the created_at (or completed earlier than started).
174+
# This would cause a -23h59mn delta, which will show up as +24h
175+
# queue/run time on grafana.
176+
if started_at < created_at:
177+
logging.info(
178+
"Workflow {} started before being created.".format(task.id)
179+
)
180+
queue_time = datetime.timedelta(seconds=0)
181+
else:
182+
queue_time = started_at - created_at
183+
if completed_at < started_at:
184+
logging.info("Workflow {} finished before starting.".format(task.id))
185+
run_time = datetime.timedelta(seconds=0)
186+
else:
187+
run_time = completed_at - started_at
188+
173189
if run_time.seconds == 0:
174190
continue
175191

.ci/monolithic-linux.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
6565
-D CMAKE_CXX_FLAGS=-gmlt \
6666
-D LLVM_CCACHE_BUILD=ON \
6767
-D MLIR_ENABLE_BINDINGS_PYTHON=ON \
68+
-D FLANG_ENABLE_FLANG_RT=OFF \
6869
-D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}"
6970

7071
echo "--- ninja"
@@ -95,6 +96,9 @@ if [[ "${runtimes}" != "" ]]; then
9596
cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
9697
-D CMAKE_C_COMPILER="${INSTALL_DIR}/bin/clang" \
9798
-D CMAKE_CXX_COMPILER="${INSTALL_DIR}/bin/clang++" \
99+
-D CMAKE_Fortran_COMPILER="${BUILD_DIR}/bin/flang" \
100+
-D CMAKE_Fortran_COMPILER_WORKS=ON \
101+
-D LLVM_BINARY_DIR="${BUILD_DIR}" \
98102
-D LLVM_ENABLE_RUNTIMES="${runtimes}" \
99103
-D LIBCXX_CXX_ABI=libcxxabi \
100104
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
@@ -113,6 +117,9 @@ if [[ "${runtimes}" != "" ]]; then
113117
cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
114118
-D CMAKE_C_COMPILER="${INSTALL_DIR}/bin/clang" \
115119
-D CMAKE_CXX_COMPILER="${INSTALL_DIR}/bin/clang++" \
120+
-D CMAKE_Fortran_COMPILER="${BUILD_DIR}/bin/flang" \
121+
-D CMAKE_Fortran_COMPILER_WORKS=ON \
122+
-D LLVM_BINARY_DIR="${BUILD_DIR}" \
116123
-D LLVM_ENABLE_RUNTIMES="${runtimes}" \
117124
-D LIBCXX_CXX_ABI=libcxxabi \
118125
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
@@ -131,6 +138,9 @@ if [[ "${runtimes}" != "" ]]; then
131138
cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
132139
-D CMAKE_C_COMPILER="${INSTALL_DIR}/bin/clang" \
133140
-D CMAKE_CXX_COMPILER="${INSTALL_DIR}/bin/clang++" \
141+
-D CMAKE_Fortran_COMPILER="${BUILD_DIR}/bin/flang" \
142+
-D CMAKE_Fortran_COMPILER_WORKS=ON \
143+
-D LLVM_BINARY_DIR="${BUILD_DIR}" \
134144
-D LLVM_ENABLE_RUNTIMES="${runtimes}" \
135145
-D LIBCXX_CXX_ABI=libcxxabi \
136146
-D CMAKE_BUILD_TYPE=RelWithDebInfo \

clang/docs/ReleaseNotes.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ Bug Fixes to Attribute Support
292292
Bug Fixes to C++ Support
293293
^^^^^^^^^^^^^^^^^^^^^^^^
294294

295+
- Clang now diagnoses copy constructors taking the class by value in template instantiations. (#GH130866)
295296
- Clang is now better at keeping track of friend function template instance contexts. (#GH55509)
296297
- Clang now prints the correct instantiation context for diagnostics suppressed
297298
by template argument deduction.
@@ -308,6 +309,7 @@ Bug Fixes to C++ Support
308309
not in the last position.
309310
- Clang now correctly parses ``if constexpr`` expressions in immediate function context. (#GH123524)
310311
- Fixed an assertion failure affecting code that uses C++23 "deducing this". (#GH130272)
312+
- Clang now properly instantiates destructors for initialized members within non-delegating constructors. (#GH93251)
311313

312314
Bug Fixes to AST Handling
313315
^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -357,6 +359,10 @@ Android Support
357359
Windows Support
358360
^^^^^^^^^^^^^^^
359361

362+
- Clang now defines ``_CRT_USE_BUILTIN_OFFSETOF`` macro in MSVC-compatible mode,
363+
which makes ``offsetof`` provided by Microsoft's ``<stddef.h>`` to be defined
364+
correctly. (#GH59689)
365+
360366
LoongArch Support
361367
^^^^^^^^^^^^^^^^^
362368

clang/include/clang/Sema/Sema.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5451,7 +5451,8 @@ class Sema final : public SemaBase {
54515451
/// destructor is referenced.
54525452
void MarkVirtualBaseDestructorsReferenced(
54535453
SourceLocation Location, CXXRecordDecl *ClassDecl,
5454-
llvm::SmallPtrSetImpl<const RecordType *> *DirectVirtualBases = nullptr);
5454+
llvm::SmallPtrSetImpl<const CXXRecordDecl *> *DirectVirtualBases =
5455+
nullptr);
54555456

54565457
/// Do semantic checks to allow the complete destructor variant to be emitted
54575458
/// when the destructor is defined in another translation unit. In the Itanium

clang/lib/Basic/Targets/OSTargets.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ static void addVisualCDefines(const LangOptions &Opts, MacroBuilder &Builder) {
220220
Builder.defineMacro("_MSC_FULL_VER", Twine(Opts.MSCompatibilityVersion));
221221
// FIXME We cannot encode the revision information into 32-bits
222222
Builder.defineMacro("_MSC_BUILD", Twine(1));
223+
// Exposed by MSVC, used in their stddef.h.
224+
Builder.defineMacro("_CRT_USE_BUILTIN_OFFSETOF", Twine(1));
223225

224226
if (Opts.CPlusPlus11 && Opts.isCompatibleWithMSVC(LangOptions::MSVC2015))
225227
Builder.defineMacro("_HAS_CHAR16_T_LANGUAGE_SUPPORT", Twine(1));

clang/lib/CodeGen/CGHLSLRuntime.cpp

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ using namespace CodeGen;
4040
using namespace clang::hlsl;
4141
using namespace llvm;
4242

43+
using llvm::hlsl::CBufferRowSizeInBytes;
44+
4345
static void createResourceInitFn(CodeGenModule &CGM, llvm::GlobalVariable *GV,
4446
unsigned Slot, unsigned Space);
4547

@@ -70,7 +72,7 @@ void addDxilValVersion(StringRef ValVersionStr, llvm::Module &M) {
7072

7173
llvm::Type *
7274
CGHLSLRuntime::convertHLSLSpecificType(const Type *T,
73-
SmallVector<unsigned> *Packoffsets) {
75+
SmallVector<int32_t> *Packoffsets) {
7476
assert(T->isHLSLSpecificType() && "Not an HLSL specific type!");
7577

7678
// Check if the target has a specific translation for this type first.
@@ -174,21 +176,50 @@ createBufferHandleType(const HLSLBufferDecl *BufDecl) {
174176
return cast<HLSLAttributedResourceType>(QT.getTypePtr());
175177
}
176178

179+
// Iterates over all declarations in the HLSL buffer and based on the
180+
// packoffset or register(c#) annotations it fills outs the Layout
181+
// vector with the user-specified layout offsets.
182+
// The buffer offsets can be specified 2 ways:
183+
// 1. declarations in cbuffer {} block can have a packoffset annotation
184+
// (translates to HLSLPackOffsetAttr)
185+
// 2. default constant buffer declarations at global scope can have
186+
// register(c#) annotations (translates to HLSLResourceBindingAttr with
187+
// RegisterType::C)
188+
// It is not guaranteed that all declarations in a buffer have an annotation.
189+
// For those where it is not specified a -1 value is added to the Layout
190+
// vector. In the final layout these declarations will be placed at the end
191+
// of the HLSL buffer after all of the elements with specified offset.
177192
static void fillPackoffsetLayout(const HLSLBufferDecl *BufDecl,
178-
SmallVector<unsigned> &Layout) {
193+
SmallVector<int32_t> &Layout) {
179194
assert(Layout.empty() && "expected empty vector for layout");
180195
assert(BufDecl->hasValidPackoffset());
181196

182-
for (Decl *D : BufDecl->decls()) {
197+
for (Decl *D : BufDecl->buffer_decls()) {
183198
if (isa<CXXRecordDecl, EmptyDecl>(D) || isa<FunctionDecl>(D)) {
184199
continue;
185200
}
186201
VarDecl *VD = dyn_cast<VarDecl>(D);
187202
if (!VD || VD->getType().getAddressSpace() != LangAS::hlsl_constant)
188203
continue;
189-
assert(VD->hasAttr<HLSLPackOffsetAttr>() &&
190-
"expected packoffset attribute on every declaration");
191-
size_t Offset = VD->getAttr<HLSLPackOffsetAttr>()->getOffsetInBytes();
204+
205+
if (!VD->hasAttrs()) {
206+
Layout.push_back(-1);
207+
continue;
208+
}
209+
210+
int32_t Offset = -1;
211+
for (auto *Attr : VD->getAttrs()) {
212+
if (auto *POA = dyn_cast<HLSLPackOffsetAttr>(Attr)) {
213+
Offset = POA->getOffsetInBytes();
214+
break;
215+
}
216+
auto *RBA = dyn_cast<HLSLResourceBindingAttr>(Attr);
217+
if (RBA &&
218+
RBA->getRegisterType() == HLSLResourceBindingAttr::RegisterType::C) {
219+
Offset = RBA->getSlotNumber() * CBufferRowSizeInBytes;
220+
break;
221+
}
222+
}
192223
Layout.push_back(Offset);
193224
}
194225
}
@@ -207,7 +238,7 @@ void CGHLSLRuntime::addBuffer(const HLSLBufferDecl *BufDecl) {
207238
return;
208239

209240
// create global variable for the constant buffer
210-
SmallVector<unsigned> Layout;
241+
SmallVector<int32_t> Layout;
211242
if (BufDecl->hasValidPackoffset())
212243
fillPackoffsetLayout(BufDecl, Layout);
213244

clang/lib/CodeGen/CGHLSLRuntime.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ class CGHLSLRuntime {
146146

147147
llvm::Type *
148148
convertHLSLSpecificType(const Type *T,
149-
SmallVector<unsigned> *Packoffsets = nullptr);
149+
SmallVector<int32_t> *Packoffsets = nullptr);
150150

151151
void annotateHLSLResource(const VarDecl *D, llvm::GlobalVariable *GV);
152152
void generateGlobalCtorDtorCalls();

0 commit comments

Comments
 (0)