Skip to content

Commit 6dfd4ed

Browse files
author
Jenkins
committed
merge main into amd-staging
Change-Id: I99bcb1456baa1b5efd3ffdfcb9fe57d1923359f7
2 parents c915d19 + f40ee6e commit 6dfd4ed

File tree

143 files changed

+2216
-677
lines changed

Some content is hidden

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

143 files changed

+2216
-677
lines changed

.ci/generate-buildkite-pipeline-premerge

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,7 @@ linux_projects=$(add-dependencies ${linux_projects_to_test} | sort | uniq)
233233

234234
windows_projects_to_test=$(exclude-windows $(compute-projects-to-test ${modified_projects}))
235235
windows_check_targets=$(check-targets ${windows_projects_to_test} | sort | uniq)
236-
# Temporary disable the windows job.
237-
# See https://discourse.llvm.org/t/rfc-future-of-windows-pre-commit-ci/76840
238-
#windows_projects=$(add-dependencies ${windows_projects_to_test} | sort | uniq)
239-
windows_projects=""
236+
windows_projects=$(add-dependencies ${windows_projects_to_test} | sort | uniq)
240237

241238
# Generate the appropriate pipeline
242239
if [[ "${linux_projects}" != "" ]]; then

.ci/monolithic-windows.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ targets="${2}"
3838

3939
echo "--- cmake"
4040
pip install -q -r ${MONOREPO_ROOT}/mlir/python/requirements.txt
41+
42+
# The CMAKE_*_LINKER_FLAGS to disable the manifest come from research
43+
# on fixing a build reliability issue on the build server, please
44+
# see https://github.com/llvm/llvm-project/pull/82393 and
45+
# https://discourse.llvm.org/t/rfc-future-of-windows-pre-commit-ci/76840/40
46+
# for further information.
4147
cmake -S ${MONOREPO_ROOT}/llvm -B ${BUILD_DIR} \
4248
-D LLVM_ENABLE_PROJECTS="${projects}" \
4349
-G Ninja \
@@ -49,7 +55,10 @@ cmake -S ${MONOREPO_ROOT}/llvm -B ${BUILD_DIR} \
4955
-D COMPILER_RT_BUILD_ORC=OFF \
5056
-D CMAKE_C_COMPILER_LAUNCHER=sccache \
5157
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache \
52-
-D MLIR_ENABLE_BINDINGS_PYTHON=ON
58+
-D MLIR_ENABLE_BINDINGS_PYTHON=ON \
59+
-D CMAKE_EXE_LINKER_FLAGS="/MANIFEST:NO" \
60+
-D CMAKE_MODULE_LINKER_FLAGS="/MANIFEST:NO" \
61+
-D CMAKE_SHARED_LINKER_FLAGS="/MANIFEST:NO"
5362

5463
echo "--- ninja"
5564
# Targets are not escaped as they are passed as separate arguments.

.github/workflows/release-tasks.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
name: Create a New Release
2929
runs-on: ubuntu-latest
3030
needs: validate-tag
31+
3132
steps:
3233
- name: Install Dependencies
3334
run: |
@@ -40,8 +41,9 @@ jobs:
4041
- name: Create Release
4142
env:
4243
GITHUB_TOKEN: ${{ github.token }}
44+
USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }}
4345
run: |
44-
./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --release ${{ needs.validate-tag.outputs.release-version }} --user ${{ github.actor }} create
46+
./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --release ${{ needs.validate-tag.outputs.release-version }} --user ${{ github.actor }} --user-token "$USER_TOKEN" create
4547
release-documentation:
4648
name: Build and Upload Release Documentation
4749
needs:

clang/docs/LanguageExtensions.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,7 @@ to ``float``; see below for more information on this emulation.
833833
* 32-bit ARM (natively on some architecture versions)
834834
* 64-bit ARM (AArch64) (natively on ARMv8.2a and above)
835835
* AMDGPU (natively)
836+
* NVPTX (natively)
836837
* SPIR (natively)
837838
* X86 (if SSE2 is available; natively if AVX512-FP16 is also available)
838839
* RISC-V (natively if Zfh or Zhinx is available)

clang/include/clang/Driver/Driver.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,11 @@ class Driver {
255255
/// from non-system headers are emitted.
256256
HeaderIncludeFilteringKind CCPrintHeadersFiltering = HIFIL_None;
257257

258+
/// Name of the library that provides implementations of
259+
/// IEEE-754 128-bit float math functions used by Fortran F128
260+
/// runtime library. It should be linked as needed by the linker job.
261+
std::string FlangF128MathLibrary;
262+
258263
/// Set CC_LOG_DIAGNOSTICS mode, which causes the frontend to log diagnostics
259264
/// to CCLogDiagnosticsFilename or to stderr, in a stable machine readable
260265
/// format.
@@ -446,6 +451,11 @@ class Driver {
446451
bool offloadHostOnly() const { return Offload == OffloadHost; }
447452
bool offloadDeviceOnly() const { return Offload == OffloadDevice; }
448453

454+
void setFlangF128MathLibrary(std::string name) {
455+
FlangF128MathLibrary = std::move(name);
456+
}
457+
StringRef getFlangF128MathLibrary() const { return FlangF128MathLibrary; }
458+
449459
/// Compute the desired OpenMP runtime from the flags provided.
450460
OpenMPRuntimeKind getOpenMPRuntime(const llvm::opt::ArgList &Args) const;
451461

clang/lib/Basic/Targets/NVPTX.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ NVPTXTargetInfo::NVPTXTargetInfo(const llvm::Triple &Triple,
6161
NoAsmVariants = true;
6262
GPU = CudaArch::UNUSED;
6363

64+
// PTX supports f16 as a fundamental type.
65+
HasLegalHalfType = true;
66+
HasFloat16 = true;
67+
6468
if (TargetPointerWidth == 32)
6569
resetDataLayout("e-p:32:32-i64:64-i128:128-v16:16-v32:32-n16:32:64");
6670
else if (Opts.NVPTXUseShortPointers)

clang/lib/Driver/ToolChains/BareMetal.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -368,11 +368,7 @@ void BareMetal::AddLinkRuntimeLib(const ArgList &Args,
368368
ToolChain::RuntimeLibType RLT = GetRuntimeLibType(Args);
369369
switch (RLT) {
370370
case ToolChain::RLT_CompilerRT: {
371-
const std::string FileName = getCompilerRT(Args, "builtins");
372-
llvm::StringRef BaseName = llvm::sys::path::filename(FileName);
373-
BaseName.consume_front("lib");
374-
BaseName.consume_back(".a");
375-
CmdArgs.push_back(Args.MakeArgString("-l" + BaseName));
371+
CmdArgs.push_back(getCompilerRTArgString(Args, "builtins"));
376372
return;
377373
}
378374
case ToolChain::RLT_Libgcc:
@@ -462,11 +458,6 @@ void baremetal::Linker::ConstructJob(Compilation &C, const JobAction &JA,
462458
for (const auto &LibPath : TC.getLibraryPaths())
463459
CmdArgs.push_back(Args.MakeArgString(llvm::Twine("-L", LibPath)));
464460

465-
const std::string FileName = TC.getCompilerRT(Args, "builtins");
466-
llvm::SmallString<128> PathBuf{FileName};
467-
llvm::sys::path::remove_filename(PathBuf);
468-
CmdArgs.push_back(Args.MakeArgString("-L" + PathBuf));
469-
470461
if (TC.ShouldLinkCXXStdlib(Args))
471462
TC.AddCXXStdlibLibArgs(Args, CmdArgs);
472463

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,6 +1396,14 @@ void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args,
13961396
// add the correct libraries to link against as dependents in the object
13971397
// file.
13981398
if (!TC.getTriple().isKnownWindowsMSVCEnvironment()) {
1399+
StringRef f128LibName = TC.getDriver().getFlangF128MathLibrary();
1400+
f128LibName.consume_front_insensitive("lib");
1401+
if (!f128LibName.empty()) {
1402+
CmdArgs.push_back("-lFortranFloat128Math");
1403+
addAsNeededOption(TC, Args, CmdArgs, /*as_needed=*/true);
1404+
CmdArgs.push_back(Args.MakeArgString("-l" + f128LibName));
1405+
addAsNeededOption(TC, Args, CmdArgs, /*as_needed=*/false);
1406+
}
13991407
CmdArgs.push_back("-lFortranRuntime");
14001408
CmdArgs.push_back("-lFortranDecimal");
14011409
}

clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedCallArgsChecker.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ class UncountedCallArgsChecker
170170
if (!Callee)
171171
return false;
172172

173+
if (isMethodOnWTFContainerType(Callee))
174+
return true;
175+
173176
auto overloadedOperatorType = Callee->getOverloadedOperator();
174177
if (overloadedOperatorType == OO_EqualEqual ||
175178
overloadedOperatorType == OO_ExclaimEqual ||
@@ -198,6 +201,31 @@ class UncountedCallArgsChecker
198201
return false;
199202
}
200203

204+
bool isMethodOnWTFContainerType(const FunctionDecl *Decl) const {
205+
if (!isa<CXXMethodDecl>(Decl))
206+
return false;
207+
auto *ClassDecl = Decl->getParent();
208+
if (!ClassDecl || !isa<CXXRecordDecl>(ClassDecl))
209+
return false;
210+
211+
auto *NsDecl = ClassDecl->getParent();
212+
if (!NsDecl || !isa<NamespaceDecl>(NsDecl))
213+
return false;
214+
215+
auto MethodName = safeGetName(Decl);
216+
auto ClsNameStr = safeGetName(ClassDecl);
217+
StringRef ClsName = ClsNameStr; // FIXME: Make safeGetName return StringRef.
218+
auto NamespaceName = safeGetName(NsDecl);
219+
// FIXME: These should be implemented via attributes.
220+
return NamespaceName == "WTF" &&
221+
(MethodName == "find" || MethodName == "findIf" ||
222+
MethodName == "reverseFind" || MethodName == "reverseFindIf" ||
223+
MethodName == "get" || MethodName == "inlineGet" ||
224+
MethodName == "contains" || MethodName == "containsIf") &&
225+
(ClsName.ends_with("Vector") || ClsName.ends_with("Set") ||
226+
ClsName.ends_with("Map"));
227+
}
228+
201229
void reportBug(const Expr *CallArg, const ParmVarDecl *Param) const {
202230
assert(CallArg);
203231

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.webkit.UncountedCallArgsChecker -verify %s
2+
3+
#include "mock-types.h"
4+
5+
namespace WTF {
6+
7+
template <typename T>
8+
class HashSet {
9+
public:
10+
template <typename U> T* find(U&) const;
11+
template <typename U> bool contains(U&) const;
12+
unsigned size() { return m_size; }
13+
template <typename U> void add(U&) const;
14+
template <typename U> void remove(U&) const;
15+
16+
private:
17+
T* m_table { nullptr };
18+
unsigned m_size { 0 };
19+
};
20+
21+
template <typename T, typename S>
22+
class HashMap {
23+
public:
24+
struct Item {
25+
T key;
26+
S value;
27+
};
28+
29+
template <typename U> Item* find(U&) const;
30+
template <typename U> bool contains(U&) const;
31+
template <typename U> S* get(U&) const;
32+
template <typename U> S* inlineGet(U&) const;
33+
template <typename U> void add(U&) const;
34+
template <typename U> void remove(U&) const;
35+
36+
private:
37+
Item* m_table { nullptr };
38+
};
39+
40+
template <typename T>
41+
class WeakHashSet {
42+
public:
43+
template <typename U> T* find(U&) const;
44+
template <typename U> bool contains(U&) const;
45+
template <typename U> void add(U&) const;
46+
template <typename U> void remove(U&) const;
47+
};
48+
49+
template <typename T>
50+
class Vector {
51+
public:
52+
unsigned size() { return m_size; }
53+
T& at(unsigned i) { return m_buffer[i]; }
54+
T& operator[](unsigned i) { return m_buffer[i]; }
55+
template <typename U> unsigned find(U&);
56+
template <typename U> unsigned reverseFind(U&);
57+
template <typename U> bool contains(U&);
58+
template <typename MatchFunction> unsigned findIf(const MatchFunction& match)
59+
{
60+
for (unsigned i = 0; i < m_size; ++i) {
61+
if (match(at(i)))
62+
return i;
63+
}
64+
return static_cast<unsigned>(-1);
65+
}
66+
template <typename MatchFunction> unsigned reverseFindIf(const MatchFunction& match)
67+
{
68+
for (unsigned i = 0; i < m_size; ++i) {
69+
if (match(at(m_size - i)))
70+
return i;
71+
}
72+
return static_cast<unsigned>(-1);
73+
}
74+
template <typename MatchFunction> bool containsIf(const MatchFunction& match)
75+
{
76+
for (unsigned i = 0; i < m_size; ++i) {
77+
if (match(at(m_size - i)))
78+
return true;
79+
}
80+
return false;
81+
}
82+
template <typename U> void append(U&) const;
83+
template <typename U> void remove(U&) const;
84+
85+
private:
86+
T* m_buffer { nullptr };
87+
unsigned m_size { 0 };
88+
};
89+
90+
}
91+
92+
using WTF::HashSet;
93+
using WTF::HashMap;
94+
using WTF::WeakHashSet;
95+
using WTF::Vector;
96+
97+
class RefCounted {
98+
public:
99+
void ref() const;
100+
void deref() const;
101+
};
102+
103+
RefCounted* object();
104+
105+
void test() {
106+
HashSet<RefPtr<RefCounted>> set;
107+
set.find(*object());
108+
set.contains(*object());
109+
set.add(*object());
110+
// expected-warning@-1{{Call argument is uncounted and unsafe}}
111+
set.remove(*object());
112+
// expected-warning@-1{{Call argument is uncounted and unsafe}}
113+
114+
HashMap<Ref<RefCounted>, unsigned> map;
115+
map.find(*object());
116+
map.contains(*object());
117+
map.inlineGet(*object());
118+
map.add(*object());
119+
// expected-warning@-1{{Call argument is uncounted and unsafe}}
120+
map.remove(*object());
121+
// expected-warning@-1{{Call argument is uncounted and unsafe}}
122+
123+
WeakHashSet<Ref<RefCounted>> weakSet;
124+
weakSet.find(*object());
125+
weakSet.contains(*object());
126+
weakSet.add(*object());
127+
// expected-warning@-1{{Call argument is uncounted and unsafe}}
128+
weakSet.remove(*object());
129+
// expected-warning@-1{{Call argument is uncounted and unsafe}}
130+
131+
Vector<Ref<RefCounted>> vector;
132+
vector.at(0);
133+
vector[0];
134+
vector.find(*object());
135+
vector.reverseFind(*object());
136+
vector.contains(*object());
137+
vector.append(*object());
138+
// expected-warning@-1{{Call argument is uncounted and unsafe}}
139+
vector.remove(*object());
140+
// expected-warning@-1{{Call argument is uncounted and unsafe}}
141+
142+
auto* obj = object();
143+
vector.findIf([&](Ref<RefCounted> key) { return key.ptr() == obj; });
144+
vector.reverseFindIf([&](Ref<RefCounted> key) { return key.ptr() == obj; });
145+
vector.containsIf([&](Ref<RefCounted> key) { return key.ptr() == obj; });
146+
}

clang/test/Driver/arm-compiler-rt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
44
// RUN: -rtlib=compiler-rt -### %s 2>&1 \
55
// RUN: | FileCheck %s -check-prefix ARM-EABI
6-
// ARM-EABI: "-lclang_rt.builtins-arm"
6+
// ARM-EABI: "{{[^"]*}}libclang_rt.builtins-arm.a"
77

88
// RUN: %clang -target arm-linux-gnueabi \
99
// RUN: --sysroot=%S/Inputs/resource_dir_with_arch_subdir \

clang/test/Driver/baremetal-multilib.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# CHECK-SAME: "-x" "c++" "{{.*}}baremetal-multilib.yaml"
1818
# CHECK-NEXT: ld{{(.exe)?}}" "{{.*}}.o" "-Bstatic"
1919
# CHECK-SAME: "-L[[SYSROOT]]/bin/../lib/clang-runtimes/arm-none-eabi/thumb/v8-m.main/fp/lib"
20-
# CHECK-SAME: "-lc" "-lm" "-lclang_rt.builtins"
20+
# CHECK-SAME: "-lc" "-lm" "{{[^"]*}}libclang_rt.builtins.a"
2121
# CHECK-SAME: "-o" "{{.*}}.tmp.out"
2222

2323
# RUN: %T/baremetal_multilib/bin/clang -no-canonical-prefixes -x c++ %s -### -o %t.out 2>&1 \

clang/test/Driver/baremetal-sysroot.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@
1818
// CHECK-V6M-C-SAME: "-x" "c++" "{{.*}}baremetal-sysroot.cpp"
1919
// CHECK-V6M-C-NEXT: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
2020
// CHECK-V6M-C-SAME: "-L{{.*}}/baremetal_default_sysroot{{[/\\]+}}bin{{[/\\]+}}..{{[/\\]+}}lib{{[/\\]+}}clang-runtimes{{[/\\]+}}armv6m-none-eabi{{[/\\]+}}lib"
21-
// CHECK-V6M-C-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m"
21+
// CHECK-V6M-C-SAME: "-lc" "-lm" "{{[^"]*}}libclang_rt.builtins-armv6m.a"
2222
// CHECK-V6M-C-SAME: "-o" "{{.*}}.o"

0 commit comments

Comments
 (0)