Skip to content

Commit 622ae78

Browse files
authored
Merge branch 'main' into x86-constexpr-avx512
2 parents e0b4d6a + 4da745a commit 622ae78

File tree

306 files changed

+27572
-3637
lines changed

Some content is hidden

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

306 files changed

+27572
-3637
lines changed

.ci/compute_projects.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
"clang": {"compiler-rt"},
8181
"clang-tools-extra": {"libc"},
8282
"libc": {"libc"},
83+
"compiler-rt": {"compiler-rt"},
8384
".ci": {"compiler-rt", "libc"},
8485
}
8586
DEPENDENT_RUNTIMES_TO_TEST_NEEDS_RECONFIG = {

.ci/compute_projects_test.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,32 @@ def test_clang_windows(self):
126126
)
127127
self.assertEqual(env_variables["enable_cir"], "OFF")
128128

129+
def test_compiler_rt(self):
130+
env_variables = compute_projects.get_env_variables(
131+
["compiler-rt/lib/asan/asan_allocator.cpp"], "Linux"
132+
)
133+
self.assertEqual(
134+
env_variables["projects_to_build"],
135+
"clang;lld",
136+
)
137+
self.assertEqual(
138+
env_variables["project_check_targets"],
139+
"",
140+
)
141+
self.assertEqual(env_variables["runtimes_to_build"], "compiler-rt")
142+
self.assertEqual(
143+
env_variables["runtimes_check_targets"],
144+
"check-compiler-rt",
145+
)
146+
self.assertEqual(
147+
env_variables["runtimes_check_targets_needs_reconfig"],
148+
"",
149+
)
150+
self.assertEqual(
151+
env_variables["enable_cir"],
152+
"OFF",
153+
)
154+
129155
def test_cir(self):
130156
env_variables = compute_projects.get_env_variables(
131157
["clang/lib/CIR/CMakeLists.txt"], "Linux"

.ci/monolithic-linux.sh

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -13,50 +13,15 @@
1313
# run only the relevant tests.
1414
#
1515

16-
set -ex
17-
set -o pipefail
16+
source .ci/utils.sh
1817

19-
MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}"
20-
BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build}"
2118
INSTALL_DIR="${BUILD_DIR}/install"
22-
rm -rf "${BUILD_DIR}"
23-
24-
sccache --zero-stats
2519

2620
mkdir -p artifacts/reproducers
2721

28-
# Make sure any clang reproducers will end up as artifacts.
22+
# Make sure any clang reproducers will end up as artifacts
2923
export CLANG_CRASH_DIAGNOSTICS_DIR=`realpath artifacts/reproducers`
3024

31-
function at-exit {
32-
retcode=$?
33-
34-
sccache --show-stats > artifacts/sccache_stats.txt
35-
cp "${BUILD_DIR}"/.ninja_log artifacts/.ninja_log
36-
cp "${BUILD_DIR}"/test-results.*.xml artifacts/ || :
37-
38-
# If building fails there will be no results files.
39-
shopt -s nullglob
40-
41-
if [[ "$GITHUB_STEP_SUMMARY" != "" ]]; then
42-
python3 "${MONOREPO_ROOT}"/.ci/generate_test_report_github.py \
43-
$retcode "${BUILD_DIR}"/test-results.*.xml >> $GITHUB_STEP_SUMMARY
44-
fi
45-
}
46-
trap at-exit EXIT
47-
48-
function start-group {
49-
groupname=$1
50-
if [[ "$GITHUB_ACTIONS" != "" ]]; then
51-
echo "::endgroup"
52-
echo "::group::$groupname"
53-
elif [[ "$POSTCOMMIT_CI" != "" ]]; then
54-
echo "@@@$STEP@@@"
55-
else
56-
echo "Starting $groupname"
57-
fi
58-
}
59-
6025
projects="${1}"
6126
targets="${2}"
6227
runtimes="${3}"

.ci/monolithic-windows.sh

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -13,44 +13,7 @@
1313
# run only the relevant tests.
1414
#
1515

16-
set -ex
17-
set -o pipefail
18-
19-
MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}"
20-
BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build}"
21-
22-
rm -rf "${BUILD_DIR}"
23-
24-
sccache --zero-stats
25-
function at-exit {
26-
retcode=$?
27-
28-
mkdir -p artifacts
29-
sccache --show-stats >> artifacts/sccache_stats.txt
30-
cp "${BUILD_DIR}"/.ninja_log artifacts/.ninja_log
31-
cp "${BUILD_DIR}"/test-results.*.xml artifacts/ || :
32-
33-
# If building fails there will be no results files.
34-
shopt -s nullglob
35-
36-
if [[ "$GITHUB_STEP_SUMMARY" != "" ]]; then
37-
python "${MONOREPO_ROOT}"/.ci/generate_test_report_github.py \
38-
$retcode "${BUILD_DIR}"/test-results.*.xml >> $GITHUB_STEP_SUMMARY
39-
fi
40-
}
41-
trap at-exit EXIT
42-
43-
function start-group {
44-
groupname=$1
45-
if [[ "$GITHUB_ACTIONS" != "" ]]; then
46-
echo "::endgroup"
47-
echo "::group::$groupname"
48-
elif [[ "$POSTCOMMIT_CI" != "" ]]; then
49-
echo "@@@$STEP@@@"
50-
else
51-
echo "Starting $groupname"
52-
fi
53-
}
16+
source .ci/utils.sh
5417

5518
projects="${1}"
5619
targets="${2}"

.ci/utils.sh

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/usr/bin/env bash
2+
#===----------------------------------------------------------------------===##
3+
#
4+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5+
# See https://llvm.org/LICENSE.txt for license information.
6+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7+
#
8+
#===----------------------------------------------------------------------===##
9+
10+
# This script performs some setup and contains some utilities used for in the
11+
# monolithic-linux.sh and monolithic-windows.sh scripts.
12+
13+
set -ex
14+
set -o pipefail
15+
16+
MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}"
17+
BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build}"
18+
19+
rm -rf "${BUILD_DIR}"
20+
21+
sccache --zero-stats
22+
23+
function at-exit {
24+
retcode=$?
25+
26+
mkdir -p artifacts
27+
sccache --show-stats >> artifacts/sccache_stats.txt
28+
cp "${BUILD_DIR}"/.ninja_log artifacts/.ninja_log
29+
cp "${BUILD_DIR}"/test-results.*.xml artifacts/ || :
30+
31+
# If building fails there will be no results files.
32+
shopt -s nullglob
33+
34+
if [[ "$GITHUB_STEP_SUMMARY" != "" ]]; then
35+
python "${MONOREPO_ROOT}"/.ci/generate_test_report_github.py \
36+
$retcode "${BUILD_DIR}"/test-results.*.xml >> $GITHUB_STEP_SUMMARY
37+
fi
38+
}
39+
trap at-exit EXIT
40+
41+
function start-group {
42+
groupname=$1
43+
if [[ "$GITHUB_ACTIONS" != "" ]]; then
44+
echo "::endgroup"
45+
echo "::group::$groupname"
46+
elif [[ "$POSTCOMMIT_CI" != "" ]]; then
47+
echo "@@@$STEP@@@"
48+
else
49+
echo "Starting $groupname"
50+
fi
51+
}

bolt/unittests/Core/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ add_bolt_unittest(CoreTests
1111
MemoryMaps.cpp
1212
DynoStats.cpp
1313

14+
# FIXME CoreTests uses `llvm::detail::TakeError(llvm::Error)`, but linking
15+
# to LLVMTestingSupport introduces a transitive dependency on the
16+
# dynamic LLVM library when LLVM_LINK_LLVM_DYLIB is ON.
17+
${LLVM_MAIN_SRC_DIR}/lib/Testing/Support/Error.cpp
18+
1419
DISABLE_LLVM_LINK_LLVM_DYLIB
1520
)
1621

@@ -20,7 +25,6 @@ target_link_libraries(CoreTests
2025
LLVMBOLTRewrite
2126
LLVMBOLTProfile
2227
LLVMBOLTUtils
23-
LLVMTestingSupport
2428
)
2529

2630
foreach (tgt ${BOLT_TARGETS_TO_BUILD})

bolt/unittests/Profile/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ target_link_libraries(ProfileTests
1616
LLVMBOLTCore
1717
LLVMBOLTProfile
1818
LLVMTargetParser
19-
LLVMTestingSupport
2019
)
2120

2221
foreach (tgt ${BOLT_TARGETS_TO_BUILD})

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13531,6 +13531,11 @@ def err_acc_invalid_default_type
1353113531
def err_acc_device_type_multiple_archs
1353213532
: Error<"OpenACC 'device_type' clause on a 'set' construct only permits "
1353313533
"one architecture">;
13534+
def warn_acc_var_referenced_non_const_array
13535+
: Warning<"variable of array type %0 referenced in OpenACC '%1' clause "
13536+
"does not have constant bounds; initialization will happen after "
13537+
"decay to pointer">,
13538+
InGroup<DiagGroup<"openacc-var-non-const-array">>;
1353413539
def warn_acc_var_referenced_lacks_op
1353513540
: Warning<"variable of type %0 referenced in OpenACC '%1' clause does not "
1353613541
"have a %enum_select<AccVarReferencedReason>{%DefCtor{default "

clang/lib/Analysis/UnsafeBufferUsage.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1986,6 +1986,14 @@ class UnsafeLibcFunctionCallGadget : public WarningGadget {
19861986
const auto *FD = dyn_cast<FunctionDecl>(CE->getDirectCallee());
19871987
if (!FD)
19881988
return false;
1989+
1990+
bool IsGlobalAndNotInAnyNamespace =
1991+
FD->isGlobal() && !FD->getEnclosingNamespaceContext()->isNamespace();
1992+
1993+
// A libc function must either be in the std:: namespace or a global
1994+
// function that is not in any namespace:
1995+
if (!FD->isInStdNamespace() && !IsGlobalAndNotInAnyNamespace)
1996+
return false;
19891997
auto isSingleStringLiteralArg = false;
19901998
if (CE->getNumArgs() == 1) {
19911999
isSingleStringLiteralArg =

clang/lib/CodeGen/CGExpr.cpp

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3789,33 +3789,50 @@ void CodeGenFunction::EmitCheck(
37893789
Branch->setMetadata(llvm::LLVMContext::MD_prof, Node);
37903790
EmitBlock(Handlers);
37913791

3792+
// Clear arguments for the MinimalRuntime handler.
3793+
if (CGM.getCodeGenOpts().SanitizeMinimalRuntime) {
3794+
switch (CheckHandler) {
3795+
case SanitizerHandler::TypeMismatch:
3796+
// Pass value pointer only. It adds minimal overhead.
3797+
StaticArgs = {};
3798+
assert(DynamicArgs.size() == 1);
3799+
break;
3800+
default:
3801+
// No arguments for other checks.
3802+
StaticArgs = {};
3803+
DynamicArgs = {};
3804+
break;
3805+
}
3806+
}
3807+
37923808
// Handler functions take an i8* pointing to the (handler-specific) static
37933809
// information block, followed by a sequence of intptr_t arguments
37943810
// representing operand values.
37953811
SmallVector<llvm::Value *, 4> Args;
37963812
SmallVector<llvm::Type *, 4> ArgTypes;
3797-
if (!CGM.getCodeGenOpts().SanitizeMinimalRuntime) {
3798-
Args.reserve(DynamicArgs.size() + 1);
3799-
ArgTypes.reserve(DynamicArgs.size() + 1);
3800-
3801-
// Emit handler arguments and create handler function type.
3802-
if (!StaticArgs.empty()) {
3803-
llvm::Constant *Info = llvm::ConstantStruct::getAnon(StaticArgs);
3804-
auto *InfoPtr = new llvm::GlobalVariable(
3805-
CGM.getModule(), Info->getType(), false,
3806-
llvm::GlobalVariable::PrivateLinkage, Info, "", nullptr,
3807-
llvm::GlobalVariable::NotThreadLocal,
3808-
CGM.getDataLayout().getDefaultGlobalsAddressSpace());
3809-
InfoPtr->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
3810-
CGM.getSanitizerMetadata()->disableSanitizerForGlobal(InfoPtr);
3811-
Args.push_back(InfoPtr);
3812-
ArgTypes.push_back(Args.back()->getType());
3813-
}
38143813

3815-
for (llvm::Value *DynamicArg : DynamicArgs) {
3816-
Args.push_back(EmitCheckValue(DynamicArg));
3817-
ArgTypes.push_back(IntPtrTy);
3818-
}
3814+
Args.reserve(DynamicArgs.size() + 1);
3815+
ArgTypes.reserve(DynamicArgs.size() + 1);
3816+
3817+
// Emit handler arguments and create handler function type.
3818+
if (!StaticArgs.empty()) {
3819+
llvm::Constant *Info = llvm::ConstantStruct::getAnon(StaticArgs);
3820+
auto *InfoPtr = new llvm::GlobalVariable(
3821+
CGM.getModule(), Info->getType(),
3822+
// Non-constant global is used in a handler to deduplicate reports.
3823+
// TODO: change deduplication logic and make it constant.
3824+
/*isConstant=*/false, llvm::GlobalVariable::PrivateLinkage, Info, "",
3825+
nullptr, llvm::GlobalVariable::NotThreadLocal,
3826+
CGM.getDataLayout().getDefaultGlobalsAddressSpace());
3827+
InfoPtr->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
3828+
CGM.getSanitizerMetadata()->disableSanitizerForGlobal(InfoPtr);
3829+
Args.push_back(InfoPtr);
3830+
ArgTypes.push_back(Args.back()->getType());
3831+
}
3832+
3833+
for (llvm::Value *DynamicArg : DynamicArgs) {
3834+
Args.push_back(EmitCheckValue(DynamicArg));
3835+
ArgTypes.push_back(IntPtrTy);
38193836
}
38203837

38213838
llvm::FunctionType *FnType =

0 commit comments

Comments
 (0)