Skip to content

Commit 837724e

Browse files
authored
Merge pull request llvm#467 from AMD-Lightning-Internal/amd/merge/upstream_merge_20250203205535
merge main into amd-staging
2 parents 46f1217 + 6f3f5c0 commit 837724e

File tree

341 files changed

+12635
-3027
lines changed

Some content is hidden

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

341 files changed

+12635
-3027
lines changed

.github/workflows/build-ci-container.yml

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,31 @@ on:
2020
jobs:
2121
build-ci-container:
2222
if: github.repository_owner == 'llvm'
23-
runs-on: depot-ubuntu-22.04-16
24-
outputs:
25-
container-name: ${{ steps.vars.outputs.container-name }}
26-
container-name-agent: ${{ steps.vars.outputs.container-name-agent }}
27-
container-name-tag: ${{ steps.vars.outputs.container-name-tag }}
28-
container-name-agent-tag: ${{ steps.vars.outputs.container-name-agent-tag }}
29-
container-filename: ${{ steps.vars.outputs.container-filename }}
30-
container-agent-filename: ${{ steps.vars.outputs.container-agent-filename }}
23+
runs-on: ${{ matrix.runs-on }}
24+
strategy:
25+
matrix:
26+
include:
27+
# The arch names should match the names used on dockerhub.
28+
# See https://github.com/docker-library/official-images#architectures-other-than-amd64
29+
- arch: amd64
30+
runs-on: depot-ubuntu-22.04-16
31+
- arch: arm64v8
32+
runs-on: depot-ubuntu-22.04-arm-16
3133
steps:
3234
- name: Checkout LLVM
3335
uses: actions/checkout@v4
3436
with:
3537
sparse-checkout: .github/workflows/containers/github-action-ci/
38+
# podman is not installed by default on the ARM64 images.
39+
- name: Install Podman
40+
if: runner.arch == 'ARM64'
41+
run: |
42+
sudo apt-get install podman
3643
- name: Write Variables
3744
id: vars
3845
run: |
39-
tag=`date +%s`
40-
container_name="ghcr.io/$GITHUB_REPOSITORY_OWNER/ci-ubuntu-22.04"
46+
tag=$(git rev-parse --short=12 HEAD)
47+
container_name="ghcr.io/$GITHUB_REPOSITORY_OWNER/${{ matrix.arch }}/ci-ubuntu-22.04"
4148
echo "container-name=$container_name" >> $GITHUB_OUTPUT
4249
echo "container-name-agent=$container_name-agent" >> $GITHUB_OUTPUT
4350
echo "container-name-tag=$container_name:$tag" >> $GITHUB_OUTPUT
@@ -61,7 +68,7 @@ jobs:
6168
- name: Upload container image
6269
uses: actions/upload-artifact@v4
6370
with:
64-
name: container
71+
name: container-${{ matrix.arch }}
6572
path: "*.tar"
6673
retention-days: 14
6774

@@ -84,18 +91,29 @@ jobs:
8491
steps:
8592
- name: Download container
8693
uses: actions/download-artifact@v4
87-
with:
88-
name: container
8994

9095
- name: Push Container
9196
run: |
92-
podman load -i ${{ needs.build-ci-container.outputs.container-filename }}
93-
podman tag ${{ needs.build-ci-container.outputs.container-name-tag }} ${{ needs.build-ci-container.outputs.container-name }}:latest
97+
function push_container {
98+
image_name=$1
99+
latest_name=$(echo $image_name | sed 's/:[.0-9]\+$/:latest/g')
100+
podman tag $image_name $latest_name
101+
echo "Pushing $image_name ..."
102+
podman push $image_name
103+
echo "Pushing $latest_name ..."
104+
podman push $latest_name
105+
}
106+
94107
podman login -u ${{ github.actor }} -p $GITHUB_TOKEN ghcr.io
95-
podman push ${{ needs.build-ci-container.outputs.container-name-tag }}
96-
podman push ${{ needs.build-ci-container.outputs.container-name }}:latest
108+
for f in $(find . -iname *.tar); do
109+
image_name=$(podman load -q -i $f | sed 's/Loaded image: //g')
110+
push_container $image_name
97111
98-
podman load -i ${{ needs.build-ci-container.outputs.container-agent-filename }}
99-
podman tag ${{ needs.build-ci-container.outputs.container-name-agent-tag }} ${{ needs.build-ci-container.outputs.container-name-agent }}:latest
100-
podman push ${{ needs.build-ci-container.outputs.container-name-agent-tag }}
101-
podman push ${{ needs.build-ci-container.outputs.container-name-agent }}:latest
112+
if echo $image_name | grep '/amd64/'; then
113+
# For amd64, create an alias with the arch component removed.
114+
# This matches the convention used on dockerhub.
115+
default_image_name=$(echo $(dirname $(dirname $image_name))/$(basename $image_name))
116+
podman tag $image_name $default_image_name
117+
push_container $default_image_name
118+
fi
119+
done

.github/workflows/premerge.yaml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ permissions:
55

66
on:
77
pull_request:
8+
types:
9+
- opened
10+
- synchronize
11+
- reopened
12+
# When a PR is closed, we still start this workflow, but then skip
13+
# all the jobs, which makes it effectively a no-op. The reason to
14+
# do this is that it allows us to take advantage of concurrency groups
15+
# to cancel in progress CI jobs whenever the PR is closed.
16+
- closed
817
paths:
918
- .github/workflows/premerge.yaml
1019
push:
@@ -14,7 +23,9 @@ on:
1423

1524
jobs:
1625
premerge-checks-linux:
17-
if: github.repository_owner == 'llvm'
26+
if: >-
27+
github.repository_owner == 'llvm' &&
28+
(github.event_name != 'pull_request' || github.event.action != 'closed')
1829
runs-on: llvm-premerge-linux-runners
1930
concurrency:
2031
group: ${{ github.workflow }}-linux-${{ github.event.pull_request.number || github.sha }}
@@ -73,7 +84,9 @@ jobs:
7384
./.ci/monolithic-linux.sh "$(echo ${linux_projects} | tr ' ' ';')" "$(echo ${linux_check_targets})" "$(echo ${linux_runtimes} | tr ' ' ';')" "$(echo ${linux_runtime_check_targets})"
7485
7586
premerge-checks-windows:
76-
if: github.repository_owner == 'llvm'
87+
if: >-
88+
github.repository_owner == 'llvm' &&
89+
(github.event_name != 'pull_request' || github.event.action != 'closed')
7790
runs-on: llvm-premerge-windows-runners
7891
concurrency:
7992
group: ${{ github.workflow }}-windows-${{ github.event.pull_request.number || github.sha }}
@@ -141,7 +154,8 @@ jobs:
141154
if: >-
142155
github.repository_owner == 'llvm' &&
143156
(startswith(github.ref_name, 'release/') ||
144-
startswith(github.base_ref, 'release/'))
157+
startswith(github.base_ref, 'release/')) &&
158+
(github.event_name != 'pull_request' || github.event.action != 'closed')
145159
steps:
146160
- name: Checkout LLVM
147161
uses: actions/checkout@v4

.github/workflows/release-tasks.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,20 +89,10 @@ jobs:
8989
needs:
9090
- validate-tag
9191
- release-create
92-
strategy:
93-
fail-fast: false
94-
matrix:
95-
runs-on:
96-
- ubuntu-22.04
97-
- windows-2022
98-
- macos-13
99-
- macos-14
100-
101-
uses: ./.github/workflows/release-binaries.yml
92+
uses: ./.github/workflows/release-binaries-all.yml
10293
with:
10394
release-version: ${{ needs.validate-tag.outputs.release-version }}
10495
upload: true
105-
runs-on: ${{ matrix.runs-on }}
10696
# Called workflows don't have access to secrets by default, so we need to explicitly pass secrets that we use.
10797
secrets:
10898
RELEASE_TASKS_USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }}

clang/docs/ReleaseNotes.rst

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,13 @@ Attribute Changes in Clang
113113
Improvements to Clang's diagnostics
114114
-----------------------------------
115115

116+
- Improve the diagnostics for deleted default constructor errors for C++ class
117+
initializer lists that don't explicitly list a class member and thus attempt
118+
to implicitly default construct that member.
119+
- The ``-Wunique-object-duplication`` warning has been added to warn about objects
120+
which are supposed to only exist once per program, but may get duplicated when
121+
built into a shared library.
122+
116123
Improvements to Clang's time-trace
117124
----------------------------------
118125

@@ -154,6 +161,11 @@ AMDGPU Support
154161
NVPTX Support
155162
^^^^^^^^^^^^^^
156163

164+
Hexagon Support
165+
^^^^^^^^^^^^^^^
166+
167+
- The default compilation target has been changed from V60 to V68.
168+
157169
X86 Support
158170
^^^^^^^^^^^
159171

@@ -219,10 +231,6 @@ Code Completion
219231
Static Analyzer
220232
---------------
221233

222-
- Clang currently support extending lifetime of object bound to
223-
reference members of aggregates in CFG and ExprEngine, that are
224-
created from default member initializer.
225-
226234
New features
227235
^^^^^^^^^^^^
228236

clang/include/clang-c/Index.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2206,7 +2206,11 @@ enum CXCursorKind {
22062206
*/
22072207
CXCursor_OpenACCUpdateConstruct = 331,
22082208

2209-
CXCursor_LastStmt = CXCursor_OpenACCUpdateConstruct,
2209+
/** OpenACC atomic Construct.
2210+
*/
2211+
CXCursor_OpenACCAtomicConstruct = 332,
2212+
2213+
CXCursor_LastStmt = CXCursor_OpenACCAtomicConstruct,
22102214

22112215
/**
22122216
* Cursor that represents the translation unit itself.

clang/include/clang/AST/DeclBase.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,8 +1257,11 @@ class alignas(8) Decl {
12571257
int64_t getID() const;
12581258

12591259
/// Looks through the Decl's underlying type to extract a FunctionType
1260-
/// when possible. Will return null if the type underlying the Decl does not
1261-
/// have a FunctionType.
1260+
/// when possible. This includes direct FunctionDecls, along with various
1261+
/// function types and typedefs. This includes function pointers/references,
1262+
/// member function pointers, and optionally if \p BlocksToo is set
1263+
/// Objective-C block pointers. Returns nullptr if the type underlying the
1264+
/// Decl does not have a FunctionType.
12621265
const FunctionType *getFunctionType(bool BlocksToo = true) const;
12631266

12641267
// Looks through the Decl's underlying type to determine if it's a

clang/include/clang/AST/RecursiveASTVisitor.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4099,6 +4099,8 @@ DEF_TRAVERSE_STMT(OpenACCSetConstruct,
40994099
{ TRY_TO(VisitOpenACCClauseList(S->clauses())); })
41004100
DEF_TRAVERSE_STMT(OpenACCUpdateConstruct,
41014101
{ TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4102+
DEF_TRAVERSE_STMT(OpenACCAtomicConstruct,
4103+
{ TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
41024104

41034105
// Traverse HLSL: Out argument expression
41044106
DEF_TRAVERSE_STMT(HLSLOutArgExpr, {})

clang/include/clang/AST/StmtOpenACC.h

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -751,5 +751,50 @@ class OpenACCUpdateConstruct final
751751
Create(const ASTContext &C, SourceLocation Start, SourceLocation DirectiveLoc,
752752
SourceLocation End, ArrayRef<const OpenACCClause *> Clauses);
753753
};
754+
755+
// This class represents the 'atomic' construct, which has an associated
756+
// statement, but no clauses.
757+
class OpenACCAtomicConstruct final : public OpenACCAssociatedStmtConstruct {
758+
759+
friend class ASTStmtReader;
760+
OpenACCAtomicKind AtomicKind = OpenACCAtomicKind::None;
761+
762+
OpenACCAtomicConstruct(EmptyShell)
763+
: OpenACCAssociatedStmtConstruct(
764+
OpenACCAtomicConstructClass, OpenACCDirectiveKind::Atomic,
765+
SourceLocation{}, SourceLocation{}, SourceLocation{},
766+
/*AssociatedStmt=*/nullptr) {}
767+
768+
OpenACCAtomicConstruct(SourceLocation Start, SourceLocation DirectiveLoc,
769+
OpenACCAtomicKind AtKind, SourceLocation End,
770+
Stmt *AssociatedStmt)
771+
: OpenACCAssociatedStmtConstruct(OpenACCAtomicConstructClass,
772+
OpenACCDirectiveKind::Atomic, Start,
773+
DirectiveLoc, End, AssociatedStmt),
774+
AtomicKind(AtKind) {}
775+
776+
void setAssociatedStmt(Stmt *S) {
777+
OpenACCAssociatedStmtConstruct::setAssociatedStmt(S);
778+
}
779+
780+
public:
781+
static bool classof(const Stmt *T) {
782+
return T->getStmtClass() == OpenACCAtomicConstructClass;
783+
}
784+
785+
static OpenACCAtomicConstruct *CreateEmpty(const ASTContext &C);
786+
static OpenACCAtomicConstruct *
787+
Create(const ASTContext &C, SourceLocation Start, SourceLocation DirectiveLoc,
788+
OpenACCAtomicKind AtKind, SourceLocation End, Stmt *AssociatedStmt);
789+
790+
OpenACCAtomicKind getAtomicKind() const { return AtomicKind; }
791+
const Stmt *getAssociatedStmt() const {
792+
return OpenACCAssociatedStmtConstruct::getAssociatedStmt();
793+
}
794+
Stmt *getAssociatedStmt() {
795+
return OpenACCAssociatedStmtConstruct::getAssociatedStmt();
796+
}
797+
};
798+
754799
} // namespace clang
755800
#endif // LLVM_CLANG_AST_STMTOPENACC_H

clang/include/clang/AST/TextNodeDumper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,7 @@ class TextNodeDumper
420420
void VisitOpenACCSetConstruct(const OpenACCSetConstruct *S);
421421
void VisitOpenACCShutdownConstruct(const OpenACCShutdownConstruct *S);
422422
void VisitOpenACCUpdateConstruct(const OpenACCUpdateConstruct *S);
423+
void VisitOpenACCAtomicConstruct(const OpenACCAtomicConstruct *S);
423424
void VisitOpenACCAsteriskSizeExpr(const OpenACCAsteriskSizeExpr *S);
424425
void VisitEmbedExpr(const EmbedExpr *S);
425426
void VisitAtomicExpr(const AtomicExpr *AE);

clang/include/clang/Basic/Attr.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def OpenCLKernelFunction
198198
// inclusive nature of subject testing).
199199
def HasFunctionProto : SubsetSubject<DeclBase,
200200
[{(S->getFunctionType(true) != nullptr &&
201-
isa<FunctionProtoType>(S->getFunctionType())) ||
201+
isa<FunctionProtoType>(S->getFunctionType())) ||
202202
isa<ObjCMethodDecl>(S) ||
203203
isa<BlockDecl>(S)}],
204204
"non-K&R-style functions">;

clang/include/clang/Basic/BuiltinsX86.td

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ let Attributes = [Const, NoThrow, RequiredVectorWidth<128>] in {
130130
}
131131
}
132132

133+
let Features = "sse", Header = "xmmintrin.h", Attributes = [NoThrow, Const] in {
134+
def _mm_prefetch : X86LibBuiltin<"void(void const *, int)">;
135+
}
136+
133137
// AVX
134138
let Attributes = [Const, NoThrow, RequiredVectorWidth<256>], Features = "avx" in {
135139
foreach Op = ["addsub", "hadd", "hsub", "max", "min"] in {
@@ -138,6 +142,12 @@ let Attributes = [Const, NoThrow, RequiredVectorWidth<256>], Features = "avx" in
138142
}
139143
}
140144

145+
// PRFCHW
146+
let Features = "prfchw", Header = "intrin.h", Attributes = [NoThrow, Const] in {
147+
def _m_prefetch : X86LibBuiltin<"void(void *)">;
148+
def _m_prefetchw : X86LibBuiltin<"void(void volatile const *)">;
149+
}
150+
141151

142152
// Mechanically ported builtins from the original `.def` file.
143153
//
@@ -146,10 +156,6 @@ let Attributes = [Const, NoThrow, RequiredVectorWidth<256>], Features = "avx" in
146156
// current formulation is based on what was easiest to recognize from the
147157
// pre-TableGen version.
148158

149-
let Features = "mmx", Attributes = [NoThrow, Const] in {
150-
def _mm_prefetch : X86NoPrefixBuiltin<"void(char const *, int)">;
151-
}
152-
153159
let Features = "sse", Attributes = [NoThrow] in {
154160
def ldmxcsr : X86Builtin<"void(unsigned int)">;
155161
}

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,36 @@ def SuspiciousMemaccess : DiagGroup<"suspicious-memaccess",
694694
NonTrivialMemaccess, MemsetTransposedArgs, SuspiciousBzero]>;
695695
def StaticInInline : DiagGroup<"static-in-inline">;
696696
def StaticLocalInInline : DiagGroup<"static-local-in-inline">;
697+
def UniqueObjectDuplication : DiagGroup<"unique-object-duplication"> {
698+
code Documentation = [{
699+
Warns when objects which are supposed to be globally unique might get duplicated
700+
when built into a shared library.
701+
702+
If an object with hidden visibility is built into a shared library, each instance
703+
of the library will get its own copy. This can cause very subtle bugs if there was
704+
only supposed to be one copy of the object in question: singletons aren't single,
705+
changes to one object won't affect the others, the object's initializer will run
706+
once per copy, etc.
707+
708+
Specifically, this warning fires when it detects an object which:
709+
1. Appears in a header file (so it might get compiled into multiple libaries), and
710+
2. Has external linkage (otherwise it's supposed to be duplicated), and
711+
3. Has hidden visibility.
712+
713+
As well as one of the following:
714+
1. The object is mutable, or
715+
2. The object's initializer definitely has side effects.
716+
717+
The warning is best resolved by making the object ``const`` (if possible), or by explicitly
718+
giving the object non-hidden visibility, e.g. using ``__attribute((visibility("default")))``.
719+
Note that all levels of a pointer variable must be constant; ``const int*`` will
720+
trigger the warning because the pointer itself is mutable.
721+
722+
This warning is currently disabled on Windows since it uses import/export rules
723+
instead of visibility.
724+
}];
725+
}
726+
697727
def GNUStaticFloatInit : DiagGroup<"gnu-static-float-init">;
698728
def StaticFloatInit : DiagGroup<"static-float-init", [GNUStaticFloatInit]>;
699729
// Allow differentiation between GNU statement expressions in a macro versus

0 commit comments

Comments
 (0)