Skip to content

Commit 816ba77

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:09f1aaca0bdc into amd-gfx:1e7085b95985
Local branch amd-gfx 1e7085b Merged main:243588df15ed into amd-gfx:467adee02669 Remote branch main 09f1aac [CGBlocks] Remove no-op ptr-to-ptr bitcasts (NFC)
2 parents 1e7085b + 09f1aac commit 816ba77

Some content is hidden

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

41 files changed

+716
-555
lines changed

.github/workflows/new-prs.yml

Lines changed: 19 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,36 @@
11
name: "Labelling new pull requests"
2+
3+
permissions:
4+
contents: read
5+
26
on:
3-
workflow_run:
4-
workflows: ["PR Receive"]
7+
# It's safe to use pull_request_target here, because we aren't checking out
8+
# code from the pull request branch.
9+
# See https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
10+
pull_request_target:
11+
types:
12+
- opened
13+
- reopened
14+
- ready_for_review
15+
- synchronize
516

617
jobs:
718
automate-prs-labels:
819
permissions:
9-
contents: read
1020
pull-requests: write
1121
runs-on: ubuntu-latest
22+
# Ignore PRs with more than 10 commits. Pull requests with a lot of
23+
# commits tend to be accidents usually when someone made a mistake while trying
24+
# to rebase. We want to ignore these pull requests to avoid excessive
25+
# notifications.
1226
if: >
1327
github.repository == 'llvm/llvm-project' &&
14-
github.event.workflow_run.event == 'pull_request_target' &&
15-
github.event.workflow_run.conclusion == 'success'
28+
github.event.pull_request.draft == false &&
29+
github.event.pull_request.commits < 10
1630
steps:
17-
# From: https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
18-
# Updated version here: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#using-data-from-the-triggering-workflow
19-
- name: Debug
20-
run: |
21-
echo "Event: ${{ github.event.workflow_run.event }} Conclusion: ${{ github.event.workflow_run.conclusion }}"
22-
- name: 'Download artifact'
23-
uses: actions/github-script@v6
24-
with:
25-
script: |
26-
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
27-
owner: context.repo.owner,
28-
repo: context.repo.repo,
29-
run_id: context.payload.workflow_run.id
30-
});
31-
const matchArtifact = artifacts.data.artifacts.find((artifact) =>
32-
artifact.name === 'pr'
33-
);
34-
const download = await github.rest.actions.downloadArtifact({
35-
owner: context.repo.owner,
36-
repo: context.repo.repo,
37-
artifact_id: matchArtifact.id,
38-
archive_format: 'zip'
39-
});
40-
const { writeFileSync } = require('node:fs');
41-
writeFileSync('${{ github.workspace }}/pr.zip', Buffer.from(download.data));
42-
43-
- run: unzip pr.zip
44-
45-
- name: "Get PR Number"
46-
id: vars
47-
run:
48-
echo "pr-number=$(cat NR)" >> "$GITHUB_OUTPUT"
49-
5031
- uses: actions/labeler@v4
5132
with:
5233
configuration-path: .github/new-prs-labeler.yml
5334
# workaround for https://github.com/actions/labeler/issues/112
5435
sync-labels: ''
5536
repo-token: ${{ secrets.ISSUE_SUBSCRIBER_TOKEN }}
56-
pr-number: ${{ steps.vars.outputs.pr-number }}

.github/workflows/pr-receive-label.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

.github/workflows/pr-receive.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

.github/workflows/pr-subscriber-wait.py

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/pr-subscriber.yml

Lines changed: 5 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
11
name: PR Subscriber
22

33
on:
4-
workflow_run:
5-
workflows: ["PR Receive Label"]
4+
pull_request_target:
65
types:
7-
- completed
6+
- labeled
87

98
permissions:
10-
actions: read
119
contents: read
1210

1311
jobs:
1412
auto-subscribe:
1513
runs-on: ubuntu-latest
16-
if: >
17-
github.repository == 'llvm/llvm-project' &&
18-
github.event.workflow_run.event == 'pull_request' &&
19-
github.event.workflow_run.conclusion == 'success'
14+
if: github.repository == 'llvm/llvm-project'
2015
steps:
2116
- name: Setup Automation Script
2217
run: |
@@ -26,47 +21,10 @@ jobs:
2621
chmod a+x github-automation.py
2722
pip install -r requirements.txt
2823
29-
- name: 'Wait for other actions'
30-
# We can't use the concurrency tag for these jobs, because it will
31-
# cancel pending jobs if another job is running.
32-
env:
33-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34-
run: |
35-
python3 pr-subscriber-wait.py
36-
37-
38-
# From: https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
39-
# Updated version here: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#using-data-from-the-triggering-workflow
40-
- name: 'Download artifact'
41-
uses: actions/github-script@v6
42-
with:
43-
script: |
44-
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
45-
owner: context.repo.owner,
46-
repo: context.repo.repo,
47-
run_id: context.payload.workflow_run.id
48-
});
49-
const matchArtifact = artifacts.data.artifacts.find((artifact) =>
50-
artifact.name === 'pr'
51-
);
52-
const download = await github.rest.actions.downloadArtifact({
53-
owner: context.repo.owner,
54-
repo: context.repo.repo,
55-
artifact_id: matchArtifact.id,
56-
archive_format: 'zip'
57-
});
58-
const { writeFileSync } = require('node:fs');
59-
writeFileSync('${{ github.workspace }}/pr.zip', Buffer.from(download.data));
60-
61-
- run: unzip pr.zip
62-
6324
- name: Update watchers
64-
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
6525
run: |
66-
PR_NUMBER=$(cat NR)
67-
LABEL_NAME=$(cat LABEL)
6826
./github-automation.py \
6927
--token '${{ secrets.ISSUE_SUBSCRIBER_TOKEN }}' \
7028
pr-subscriber \
71-
--issue-number "$PR_NUMBER" \
72-
--label-name "$LABEL_NAME"
29+
--issue-number "${{ github.event.number }}" \
30+
--label-name "${{ github.event.label.name }}"

.github/workflows/scorecard.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ on:
1212
# To guarantee Maintained check is occasionally updated. See
1313
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
1414
schedule:
15-
- cron: '38 20 * * 4'
16-
push:
17-
branches: [ "main" ]
15+
- cron: '38 20 * * *'
1816

1917
# Declare default permissions as read only.
2018
permissions:

clang/include/clang/Driver/Distro.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ class Distro {
7878
UbuntuKinetic,
7979
UbuntuLunar,
8080
UbuntuMantic,
81+
UbuntuNoble,
8182
UnknownDistro
8283
};
8384

@@ -129,7 +130,7 @@ class Distro {
129130
}
130131

131132
bool IsUbuntu() const {
132-
return DistroVal >= UbuntuHardy && DistroVal <= UbuntuMantic;
133+
return DistroVal >= UbuntuHardy && DistroVal <= UbuntuNoble;
133134
}
134135

135136
bool IsAlpineLinux() const { return DistroVal == AlpineLinux; }

clang/lib/Basic/Module.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,10 @@ bool Module::isForBuilding(const LangOptions &LangOpts) const {
161161
StringRef TopLevelName = getTopLevelModuleName();
162162
StringRef CurrentModule = LangOpts.CurrentModule;
163163

164-
// When building framework Foo, we want to make sure that Foo *and*
165-
// Foo_Private are textually included and no modules are built for both.
166-
if (getTopLevelModule()->IsFramework &&
164+
// When building the implementation of framework Foo, we want to make sure
165+
// that Foo *and* Foo_Private are textually included and no modules are built
166+
// for either.
167+
if (!LangOpts.isCompilingModule() && getTopLevelModule()->IsFramework &&
167168
CurrentModule == LangOpts.ModuleName &&
168169
!CurrentModule.endswith("_Private") && TopLevelName.endswith("_Private"))
169170
TopLevelName = TopLevelName.drop_back(8);

clang/lib/CodeGen/CGBlocks.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,7 @@ static llvm::Constant *buildBlockDescriptor(CodeGenModule &CGM,
203203
// Signature. Mandatory ObjC-style method descriptor @encode sequence.
204204
std::string typeAtEncoding =
205205
CGM.getContext().getObjCEncodingForBlock(blockInfo.getBlockExpr());
206-
elements.add(llvm::ConstantExpr::getBitCast(
207-
CGM.GetAddrOfConstantCString(typeAtEncoding).getPointer(), i8p));
206+
elements.add(CGM.GetAddrOfConstantCString(typeAtEncoding).getPointer());
208207

209208
// GC layout.
210209
if (C.getLangOpts().ObjC) {
@@ -809,7 +808,7 @@ llvm::Value *CodeGenFunction::EmitBlockLiteral(const CGBlockInfo &blockInfo) {
809808
llvm::Constant *blockISA = blockInfo.NoEscape
810809
? CGM.getNSConcreteGlobalBlock()
811810
: CGM.getNSConcreteStackBlock();
812-
isa = llvm::ConstantExpr::getBitCast(blockISA, VoidPtrTy);
811+
isa = blockISA;
813812

814813
// Build the block descriptor.
815814
descriptor = buildBlockDescriptor(CGM, blockInfo);
@@ -1869,7 +1868,7 @@ CodeGenFunction::GenerateCopyHelperFunction(const CGBlockInfo &blockInfo) {
18691868
CaptureStrKind::CopyHelper, CGM);
18701869

18711870
if (llvm::GlobalValue *Func = CGM.getModule().getNamedValue(FuncName))
1872-
return llvm::ConstantExpr::getBitCast(Func, VoidPtrTy);
1871+
return Func;
18731872

18741873
ASTContext &C = getContext();
18751874

@@ -1990,7 +1989,7 @@ CodeGenFunction::GenerateCopyHelperFunction(const CGBlockInfo &blockInfo) {
19901989

19911990
FinishFunction();
19921991

1993-
return llvm::ConstantExpr::getBitCast(Fn, VoidPtrTy);
1992+
return Fn;
19941993
}
19951994

19961995
static BlockFieldFlags
@@ -2056,7 +2055,7 @@ CodeGenFunction::GenerateDestroyHelperFunction(const CGBlockInfo &blockInfo) {
20562055
CaptureStrKind::DisposeHelper, CGM);
20572056

20582057
if (llvm::GlobalValue *Func = CGM.getModule().getNamedValue(FuncName))
2059-
return llvm::ConstantExpr::getBitCast(Func, VoidPtrTy);
2058+
return Func;
20602059

20612060
ASTContext &C = getContext();
20622061

@@ -2113,7 +2112,7 @@ CodeGenFunction::GenerateDestroyHelperFunction(const CGBlockInfo &blockInfo) {
21132112

21142113
FinishFunction();
21152114

2116-
return llvm::ConstantExpr::getBitCast(Fn, VoidPtrTy);
2115+
return Fn;
21172116
}
21182117

21192118
namespace {
@@ -2352,7 +2351,7 @@ generateByrefCopyHelper(CodeGenFunction &CGF, const BlockByrefInfo &byrefInfo,
23522351

23532352
CGF.FinishFunction();
23542353

2355-
return llvm::ConstantExpr::getBitCast(Fn, CGF.Int8PtrTy);
2354+
return Fn;
23562355
}
23572356

23582357
/// Build the copy helper for a __block variable.
@@ -2408,7 +2407,7 @@ generateByrefDisposeHelper(CodeGenFunction &CGF,
24082407

24092408
CGF.FinishFunction();
24102409

2411-
return llvm::ConstantExpr::getBitCast(Fn, CGF.Int8PtrTy);
2410+
return Fn;
24122411
}
24132412

24142413
/// Build the dispose helper for a __block variable.

clang/lib/Driver/Distro.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ static Distro::DistroType DetectLsbRelease(llvm::vfs::FileSystem &VFS) {
9494
.Case("kinetic", Distro::UbuntuKinetic)
9595
.Case("lunar", Distro::UbuntuLunar)
9696
.Case("mantic", Distro::UbuntuMantic)
97+
.Case("noble", Distro::UbuntuNoble)
9798
.Default(Distro::UnknownDistro);
9899
return Version;
99100
}

0 commit comments

Comments
 (0)