Skip to content

Commit 92024f1

Browse files
committed
Merge branch 'main' of https://github.com/llvm/llvm-project into fix/148875
2 parents 8152e28 + cd6311b commit 92024f1

File tree

540 files changed

+11599
-3158
lines changed

Some content is hidden

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

540 files changed

+11599
-3158
lines changed

.ci/compute_projects.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
PROJECT_DEPENDENCIES = {
2020
"llvm": set(),
2121
"clang": {"llvm"},
22+
"CIR": {"clang", "mlir"},
2223
"bolt": {"clang", "lld", "llvm"},
2324
"clang-tools-extra": {"clang", "llvm"},
2425
"compiler-rt": {"clang", "lld"},
@@ -55,6 +56,7 @@
5556
".ci": {
5657
"llvm",
5758
"clang",
59+
"CIR",
5860
"lld",
5961
"lldb",
6062
"bolt",
@@ -128,6 +130,7 @@
128130
"lldb": "check-lldb",
129131
"llvm": "check-llvm",
130132
"clang": "check-clang",
133+
"CIR": "check-clang-cir",
131134
"bolt": "check-bolt",
132135
"lld": "check-lld",
133136
"flang": "check-flang",
@@ -247,6 +250,14 @@ def _get_modified_projects(modified_files: list[str]) -> Set[str]:
247250
# capacity.
248251
if len(path_parts) > 3 and path_parts[:3] == ("llvm", "utils", "gn"):
249252
continue
253+
# If the file is in the clang/lib/CIR directory, add the CIR project.
254+
if len(path_parts) > 3 and (
255+
path_parts[:3] == ("clang", "lib", "CIR")
256+
or path_parts[:3] == ("clang", "test", "CIR")
257+
or path_parts[:4] == ("clang", "include", "clang", "CIR")
258+
):
259+
modified_projects.add("CIR")
260+
# Fall through to add clang.
250261
modified_projects.add(pathlib.Path(modified_file).parts[0])
251262
return modified_projects
252263

@@ -267,6 +278,13 @@ def get_env_variables(modified_files: list[str], platform: str) -> Set[str]:
267278
runtimes_check_targets_needs_reconfig = _compute_project_check_targets(
268279
runtimes_to_test_needs_reconfig
269280
)
281+
282+
# CIR is used as a pseudo-project in this script. It is built as part of the
283+
# clang build, but it requires an explicit option to enable. We set that
284+
# option here, and remove it from the projects_to_build list.
285+
enable_cir = "ON" if "CIR" in projects_to_build else "OFF"
286+
projects_to_build.discard("CIR")
287+
270288
# We use a semicolon to separate the projects/runtimes as they get passed
271289
# to the CMake invocation and thus we need to use the CMake list separator
272290
# (;). We use spaces to separate the check targets as they end up getting
@@ -279,6 +297,7 @@ def get_env_variables(modified_files: list[str], platform: str) -> Set[str]:
279297
"runtimes_check_targets_needs_reconfig": " ".join(
280298
sorted(runtimes_check_targets_needs_reconfig)
281299
),
300+
"enable_cir": enable_cir,
282301
}
283302

284303

.ci/compute_projects_test.py

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ def test_clang(self):
104104
env_variables["runtimes_check_targets_needs_reconfig"],
105105
"check-cxx check-cxxabi check-unwind",
106106
)
107+
self.assertEqual(
108+
env_variables["enable_cir"],
109+
"OFF",
110+
)
107111

108112
def test_clang_windows(self):
109113
env_variables = compute_projects.get_env_variables(
@@ -126,6 +130,32 @@ def test_clang_windows(self):
126130
env_variables["runtimes_check_targets_needs_reconfig"],
127131
"check-cxx check-cxxabi check-unwind",
128132
)
133+
self.assertEqual(env_variables["enable_cir"], "OFF")
134+
135+
def test_cir(self):
136+
env_variables = compute_projects.get_env_variables(
137+
["clang/lib/CIR/CMakeLists.txt"], "Linux"
138+
)
139+
self.assertEqual(
140+
env_variables["projects_to_build"],
141+
"clang;clang-tools-extra;lld;llvm;mlir",
142+
)
143+
self.assertEqual(
144+
env_variables["project_check_targets"],
145+
"check-clang check-clang-cir check-clang-tools",
146+
)
147+
self.assertEqual(
148+
env_variables["runtimes_to_build"], "compiler-rt;libcxx;libcxxabi;libunwind"
149+
)
150+
self.assertEqual(
151+
env_variables["runtimes_check_targets"],
152+
"check-compiler-rt",
153+
)
154+
self.assertEqual(
155+
env_variables["runtimes_check_targets_needs_reconfig"],
156+
"check-cxx check-cxxabi check-unwind",
157+
)
158+
self.assertEqual(env_variables["enable_cir"], "ON")
129159

130160
def test_bolt(self):
131161
env_variables = compute_projects.get_env_variables(
@@ -158,6 +188,7 @@ def test_mlir(self):
158188
self.assertEqual(env_variables["runtimes_to_build"], "")
159189
self.assertEqual(env_variables["runtimes_check_targets"], "")
160190
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "")
191+
self.assertEqual(env_variables["enable_cir"], "OFF")
161192

162193
def test_flang(self):
163194
env_variables = compute_projects.get_env_variables(
@@ -168,6 +199,7 @@ def test_flang(self):
168199
self.assertEqual(env_variables["runtimes_to_build"], "")
169200
self.assertEqual(env_variables["runtimes_check_targets"], "")
170201
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "")
202+
self.assertEqual(env_variables["enable_cir"], "OFF")
171203

172204
def test_invalid_subproject(self):
173205
env_variables = compute_projects.get_env_variables(
@@ -237,7 +269,7 @@ def test_ci(self):
237269
)
238270
self.assertEqual(
239271
env_variables["project_check_targets"],
240-
"check-bolt check-clang check-clang-tools check-flang check-lld check-lldb check-llvm check-mlir check-polly",
272+
"check-bolt check-clang check-clang-cir check-clang-tools check-flang check-lld check-lldb check-llvm check-mlir check-polly",
241273
)
242274
self.assertEqual(
243275
env_variables["runtimes_to_build"],

.ci/monolithic-linux.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ targets="${2}"
4848
runtimes="${3}"
4949
runtime_targets="${4}"
5050
runtime_targets_needs_reconfig="${5}"
51+
enable_cir="${6}"
5152

5253
lit_args="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests"
5354

@@ -67,6 +68,7 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
6768
-G Ninja \
6869
-D CMAKE_PREFIX_PATH="${HOME}/.local" \
6970
-D CMAKE_BUILD_TYPE=Release \
71+
-D CLANG_ENABLE_CIR=${enable_cir} \
7072
-D LLVM_ENABLE_ASSERTIONS=ON \
7173
-D LLVM_BUILD_EXAMPLES=ON \
7274
-D COMPILER_RT_BUILD_LIBFUZZER=OFF \

.github/new-prs-labeler.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ flang:frontend:
4848
- flang/Evaluate/**/*
4949
- flang/Semantics/**/*
5050

51+
libclc:
52+
- libclc/**
53+
5154
HLSL:
5255
- clang/*HLSL*/**/*
5356
- clang/**/*HLSL*
@@ -717,6 +720,8 @@ mlgo:
717720
- llvm/lib/Analysis/IR2Vec.cpp
718721
- llvm/lib/Analysis/models/**
719722
- llvm/test/Analysis/IR2Vec/**
723+
- llvm/tools/llvm-ir2vec/**
724+
- llvm/docs/CommandGuide/llvm-ir2vec.rst
720725

721726
tools:llvm-exegesis:
722727
- llvm/tools/llvm-exegesis/**

.github/workflows/containers/github-action-ci/Dockerfile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,21 @@ RUN apt-get update && \
6363
python3-pip \
6464
ccache \
6565
file \
66-
tzdata \
67-
sccache && \
66+
tzdata && \
6867
apt-get clean && \
6968
rm -rf /var/lib/apt/lists/*
7069

70+
# We need sccache for caching. We cannot use the apt repository version because
71+
# it is too old and has bugs related to features we require (particularly GCS
72+
# caching), so we manually install it here.
73+
# TODO(boomanaiden154): We should return to installing this from the apt
74+
# repository once a version containing the necessary bug fixes is available.
75+
RUN curl -L 'https://github.com/mozilla/sccache/releases/download/v0.10.0/sccache-v0.10.0-x86_64-unknown-linux-musl.tar.gz' > /tmp/sccache.tar.gz && \
76+
echo "1fbb35e135660d04a2d5e42b59c7874d39b3deb17de56330b25b713ec59f849b /tmp/sccache.tar.gz" | sha256sum -c && \
77+
tar xzf /tmp/sccache.tar.gz -O --wildcards '*/sccache' > '/usr/local/bin/sccache' && \
78+
rm /tmp/sccache.tar.gz && \
79+
chmod +x /usr/local/bin/sccache
80+
7181
ENV LLVM_SYSROOT=$LLVM_SYSROOT
7282
ENV PATH=${LLVM_SYSROOT}/bin:${PATH}
7383

.github/workflows/premerge.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
export CC=/opt/llvm/bin/clang
6363
export CXX=/opt/llvm/bin/clang++
6464
65-
./.ci/monolithic-linux.sh "${projects_to_build}" "${project_check_targets}" "${runtimes_to_build}" "${runtimes_check_targets}" "${runtimes_check_targets_needs_reconfig}"
65+
./.ci/monolithic-linux.sh "${projects_to_build}" "${project_check_targets}" "${runtimes_to_build}" "${runtimes_check_targets}" "${runtimes_check_targets_needs_reconfig}" "${enable_cir}"
6666
- name: Upload Artifacts
6767
if: '!cancelled()'
6868
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0

clang/docs/LibClang.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,3 +404,9 @@ following situations are explicitly unsupported:
404404
compatible across library versions.
405405
* For the same reason as above, serializing objects from one version of the
406406
library and deserializing with a different version is also not supported.
407+
408+
Note: because libclang is a wrapper around the compiler frontend, it is not a
409+
`security-sensitive component`_ of the LLVM Project. Consider using a sandbox
410+
or some other mitigation approach if processing untrusted input.
411+
412+
.. _security-sensitive component: https://llvm.org/docs/Security.html#what-is-considered-a-security-issue

clang/docs/SanitizerSpecialCaseList.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Example
3939
void bad_foo() {
4040
int *a = (int*)malloc(40);
4141
a[10] = 1;
42+
free(a);
4243
}
4344
int main() { bad_foo(); }
4445
$ cat ignorelist.txt

clang/include/clang/Basic/BuiltinsAMDGPU.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,12 +669,14 @@ TARGET_BUILTIN(__builtin_amdgcn_s_monitor_sleep, "vIs", "n", "gfx1250-insts")
669669
TARGET_BUILTIN(__builtin_amdgcn_s_wait_asynccnt, "vIUs", "n", "gfx1250-insts")
670670
TARGET_BUILTIN(__builtin_amdgcn_s_wait_tensorcnt, "vIUs", "n", "gfx1250-insts")
671671

672+
TARGET_BUILTIN(__builtin_amdgcn_tanhf, "ff", "nc", "tanh-insts")
672673
TARGET_BUILTIN(__builtin_amdgcn_tanh_bf16, "yy", "nc", "bf16-trans-insts")
673674
TARGET_BUILTIN(__builtin_amdgcn_rcp_bf16, "yy", "nc", "bf16-trans-insts")
674675
TARGET_BUILTIN(__builtin_amdgcn_rsq_bf16, "yy", "nc", "bf16-trans-insts")
675676
TARGET_BUILTIN(__builtin_amdgcn_log_bf16, "yy", "nc", "bf16-trans-insts")
676677
TARGET_BUILTIN(__builtin_amdgcn_exp2_bf16, "yy", "nc", "bf16-trans-insts")
677678
TARGET_BUILTIN(__builtin_amdgcn_sin_bf16, "yy", "nc", "bf16-trans-insts")
679+
TARGET_BUILTIN(__builtin_amdgcn_cos_bf16, "yy", "nc", "bf16-trans-insts")
678680

679681
TARGET_BUILTIN(__builtin_amdgcn_cvt_f16_fp8, "hiIi", "nc", "gfx1250-insts")
680682
TARGET_BUILTIN(__builtin_amdgcn_cvt_f16_bf8, "hiIi", "nc", "gfx1250-insts")

clang/lib/AST/ExprConstant.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4450,7 +4450,8 @@ static CompleteObject findCompleteObject(EvalInfo &Info, const Expr *E,
44504450
}
44514451
} else if (!IsAccess) {
44524452
return CompleteObject(LVal.getLValueBase(), nullptr, BaseType);
4453-
} else if (IsConstant && Info.checkingPotentialConstantExpression() &&
4453+
} else if ((IsConstant || BaseType->isReferenceType()) &&
4454+
Info.checkingPotentialConstantExpression() &&
44544455
BaseType->isLiteralType(Info.Ctx) && !VD->hasDefinition()) {
44554456
// This variable might end up being constexpr. Don't diagnose it yet.
44564457
} else if (IsConstant) {
@@ -4491,9 +4492,11 @@ static CompleteObject findCompleteObject(EvalInfo &Info, const Expr *E,
44914492
// a null BaseVal. Any constexpr-unknown variable seen here is an error:
44924493
// we can't access a constexpr-unknown object.
44934494
if (AK != clang::AK_Dereference && !BaseVal) {
4494-
Info.FFDiag(E, diag::note_constexpr_access_unknown_variable, 1)
4495-
<< AK << VD;
4496-
Info.Note(VD->getLocation(), diag::note_declared_at);
4495+
if (!Info.checkingPotentialConstantExpression()) {
4496+
Info.FFDiag(E, diag::note_constexpr_access_unknown_variable, 1)
4497+
<< AK << VD;
4498+
Info.Note(VD->getLocation(), diag::note_declared_at);
4499+
}
44974500
return CompleteObject();
44984501
}
44994502
} else if (DynamicAllocLValue DA = LVal.Base.dyn_cast<DynamicAllocLValue>()) {

0 commit comments

Comments
 (0)