Skip to content

Commit 68bf805

Browse files
committed
Merge branch 'main' into pauth-gnuprop-clang & fix conflict after 6ff6191
2 parents f069c9b + 5b544b5 commit 68bf805

File tree

1,926 files changed

+87498
-17298
lines changed

Some content is hidden

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

1,926 files changed

+87498
-17298
lines changed

.github/CODEOWNERS

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ clang/test/AST/Interp/ @tbaederr
5959
/mlir/Dialect/*/Transforms/Bufferize.cpp @matthias-springer
6060

6161
# Linalg Dialect in MLIR.
62-
/mlir/include/mlir/Dialect/Linalg @dcaballe @nicolasvasilache
63-
/mlir/lib/Dialect/Linalg @dcaballe @nicolasvasilache
62+
/mlir/include/mlir/Dialect/Linalg/* @dcaballe @nicolasvasilache
63+
/mlir/lib/Dialect/Linalg/* @dcaballe @nicolasvasilache
6464
/mlir/lib/Dialect/Linalg/Transforms/DecomposeLinalgOps.cpp @MaheshRavishankar @nicolasvasilache
6565
/mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp @MaheshRavishankar @nicolasvasilache
6666
/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp @MaheshRavishankar @nicolasvasilache
@@ -77,14 +77,14 @@ clang/test/AST/Interp/ @tbaederr
7777
/mlir/**/*SME* @banach-space @dcaballe @nicolasvasilache
7878
/mlir/**/*SVE* @banach-space @dcaballe @nicolasvasilache
7979
/mlir/**/*VectorInterfaces* @dcaballe @nicolasvasilache
80-
/mlir/**/*VectorToSCF* @banach-space @dcaballe @nicolasvasilache @matthias-springer
80+
/mlir/**/*VectorToSCF* @banach-space @dcaballe @matthias-springer @nicolasvasilache
8181
/mlir/**/*VectorToLLVM* @banach-space @dcaballe @nicolasvasilache
8282
/mlir/**/*X86Vector* @aartbik @dcaballe @nicolasvasilache
83-
/mlir/include/mlir/Dialect/Vector @dcaballe @nicolasvasilache
84-
/mlir/lib/Dialect/Vector @dcaballe @nicolasvasilache
85-
/mlir/lib/Dialect/Vector/Transforms/VectorEmulateNarrowType.cpp @MaheshRavishankar @nicolasvasilache
86-
/mlir/**/*EmulateNarrowType* @hanhanW
83+
/mlir/include/mlir/Dialect/Vector/* @dcaballe @nicolasvasilache
84+
/mlir/lib/Dialect/Vector/* @dcaballe @nicolasvasilache
8785
/mlir/lib/Dialect/Vector/Transforms/* @hanhanW @nicolasvasilache
86+
/mlir/lib/Dialect/Vector/Transforms/VectorEmulateNarrowType.cpp @MaheshRavishankar @nicolasvasilache
87+
/mlir/**/*EmulateNarrowType* @dcaballe @hanhanW
8888

8989
# Presburger library in MLIR
9090
/mlir/**/*Presburger* @Groverkss @Superty
@@ -96,6 +96,7 @@ clang/test/AST/Interp/ @tbaederr
9696
# Transform Dialect in MLIR.
9797
/mlir/include/mlir/Dialect/Transform/* @ftynse @nicolasvasilache
9898
/mlir/lib/Dialect/Transform/* @ftynse @nicolasvasilache
99+
/mlir/**/*TransformOps* @ftynse @nicolasvasilache
99100

100101
# SPIR-V Dialect in MLIR.
101102
/mlir/**/SPIRV/ @antiagainst @kuhar
@@ -119,3 +120,8 @@ clang/test/AST/Interp/ @tbaederr
119120

120121
# Bazel build system.
121122
/utils/bazel/ @rupprecht
123+
124+
# InstallAPI and TextAPI
125+
/llvm/**/TextAPI/ @cyndyishida
126+
/clang/**/InstallAPI/ @cyndyishida
127+
/clang/tools/clang-installapi/ @cyndyishida

.github/workflows/issue-write.yml

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: Comment on an issue
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Check code formatting"]
6+
types:
7+
- completed
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
pr-comment:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
pull-requests: write
17+
if: >
18+
github.event.workflow_run.event == 'pull_request'
19+
steps:
20+
- name: 'Download artifact'
21+
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
22+
with:
23+
github-token: ${{ secrets.ISSUE_WRITE_DOWNLOAD_ARTIFACT }}
24+
run-id: ${{ github.event.workflow_run.id }}
25+
name: workflow-args
26+
27+
- name: 'Comment on PR'
28+
uses: actions/github-script@v3
29+
with:
30+
github-token: ${{ secrets.GITHUB_TOKEN }}
31+
script: |
32+
var fs = require('fs');
33+
const comments = JSON.parse(fs.readFileSync('./comments'));
34+
if (!comments) {
35+
return;
36+
}
37+
38+
let runInfo = await github.actions.getWorkflowRun({
39+
owner: context.repo.owner,
40+
repo: context.repo.repo,
41+
run_id: context.payload.workflow_run.id
42+
});
43+
44+
console.log(runInfo);
45+
46+
47+
// Query to find the number of the pull request that triggered this job.
48+
// The associated pull requests are based off of the branch name, so if
49+
// you create a pull request for a branch, close it, and then create
50+
// another pull request with the same branch, then this query will return
51+
// two associated pull requests. This is why we have to fetch all the
52+
// associated pull requests and then iterate through them to find the
53+
// one that is open.
54+
const gql_query = `
55+
query($repo_owner : String!, $repo_name : String!, $branch: String!) {
56+
repository(owner: $repo_owner, name: $repo_name) {
57+
ref (qualifiedName: $branch) {
58+
associatedPullRequests(first: 100) {
59+
nodes {
60+
baseRepository {
61+
owner {
62+
login
63+
}
64+
}
65+
number
66+
state
67+
}
68+
}
69+
}
70+
}
71+
}
72+
`
73+
const gql_variables = {
74+
repo_owner: runInfo.data.head_repository.owner.login,
75+
repo_name: runInfo.data.head_repository.name,
76+
branch: runInfo.data.head_branch
77+
}
78+
const gql_result = await github.graphql(gql_query, gql_variables);
79+
console.log(gql_result);
80+
console.log(gql_result.repository.ref.associatedPullRequests.nodes);
81+
82+
var pr_number = 0;
83+
gql_result.repository.ref.associatedPullRequests.nodes.forEach((pr) => {
84+
if (pr.baseRepository.owner.login = context.repo.owner && pr.state == 'OPEN') {
85+
pr_number = pr.number;
86+
}
87+
});
88+
if (pr_number == 0) {
89+
console.log("Error retrieving pull request number");
90+
return;
91+
}
92+
93+
await comments.forEach(function (comment) {
94+
if (comment.id) {
95+
// Security check: Ensure that this comment was created by
96+
// the github-actions bot, so a malicious input won't overwrite
97+
// a user's comment.
98+
github.issues.getComment({
99+
owner: context.repo.owner,
100+
repo: context.repo.repo,
101+
comment_id: comment.id
102+
}).then((old_comment) => {
103+
console.log(old_comment);
104+
if (old_comment.data.user.login != "github-actions[bot]") {
105+
console.log("Invalid comment id: " + comment.id);
106+
return;
107+
}
108+
github.issues.updateComment({
109+
owner: context.repo.owner,
110+
repo: context.repo.repo,
111+
issue_number: pr_number,
112+
comment_id: comment.id,
113+
body: comment.body
114+
});
115+
});
116+
} else {
117+
github.issues.createComment({
118+
owner: context.repo.owner,
119+
repo: context.repo.repo,
120+
issue_number: pr_number,
121+
body: comment.body
122+
});
123+
}
124+
});
125+
126+
- name: Dump comments file
127+
if: always()
128+
run: cat comments

.github/workflows/pr-code-format.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
name: "Check code formatting"
22
on:
3-
pull_request_target:
3+
pull_request:
44
branches:
55
- main
66

7-
permissions:
8-
pull-requests: write
9-
107
jobs:
118
code_formatter:
129
runs-on: ubuntu-latest
@@ -31,12 +28,13 @@ jobs:
3128
separator: ","
3229
skip_initial_fetch: true
3330

34-
# We need to make sure that we aren't executing/using any code from the
35-
# PR for security reasons as we're using pull_request_target. Checkout
36-
# the target branch with the necessary files.
31+
# We need to pull the script from the main branch, so that we ensure
32+
# we get the latest version of this script.
3733
- name: Fetch code formatting utils
3834
uses: actions/checkout@v4
3935
with:
36+
reository: ${{ github.repository }}
37+
ref: ${{ github.base_ref }}
4038
sparse-checkout: |
4139
llvm/utils/git/requirements_formatting.txt
4240
llvm/utils/git/code-format-helper.py
@@ -75,10 +73,20 @@ jobs:
7573
# to take advantage of the new --diff_from_common_commit option
7674
# explicitly in code-format-helper.py and not have to diff starting at
7775
# the merge base.
76+
# Create an empty comments file so the pr-write job doesn't fail.
7877
run: |
78+
echo "[]" > comments &&
7979
python ./code-format-tools/llvm/utils/git/code-format-helper.py \
80+
--write-comment-to-file \
8081
--token ${{ secrets.GITHUB_TOKEN }} \
8182
--issue-number $GITHUB_PR_NUMBER \
8283
--start-rev $(git merge-base $START_REV $END_REV) \
8384
--end-rev $END_REV \
8485
--changed-files "$CHANGED_FILES"
86+
87+
- uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0
88+
if: always()
89+
with:
90+
name: workflow-args
91+
path: |
92+
comments

bolt/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ if (BOLT_ENABLE_RUNTIME)
4545
execute_process(COMMAND ls /proc/self/map_files
4646
RESULT_VARIABLE LS OUTPUT_QUIET ERROR_QUIET)
4747
if (LS)
48-
set(BOLT_ENABLE_RUNTIME OFF)
4948
message(WARNING
50-
"BOLT runtime is disabled as /proc/self/map_files is unreadable.")
49+
"BOLT runtime may not be able to read /proc/self/map_files. Please use
50+
`--instrumentation-binpath <path-to-instrumented-binary>` option.")
5151
endif()
5252
endif()
5353

bolt/docs/BAT.md

Lines changed: 43 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ binary onto the original binary.
1414
# Usage
1515
`--enable-bat` flag controls the generation of BAT section. Sampled profile
1616
needs to be passed along with the optimized binary containing BAT section to
17-
`perf2bolt` which reads BAT section and produces fdata profile for the original
18-
binary. Note that YAML profile generation is not supported since BAT doesn't
19-
contain the metadata for input functions.
17+
`perf2bolt` which reads BAT section and produces profile for the original
18+
binary.
2019

2120
# Internals
2221
## Section contents
@@ -43,21 +42,21 @@ and [BoltAddressTranslation.cpp](/bolt/lib/Profile/BoltAddressTranslation.cpp).
4342
### Layout
4443
The general layout is as follows:
4544
```
46-
Hot functions table header
47-
|------------------|
48-
| Function entry |
49-
| |--------------| |
50-
| | OutOff InOff | |
51-
| |--------------| |
52-
~~~~~~~~~~~~~~~~~~~~
45+
Hot functions table
46+
Cold functions table
5347
54-
Cold functions table header
48+
Functions table:
5549
|------------------|
5650
| Function entry |
57-
| |--------------| |
58-
| | OutOff InOff | |
59-
| |--------------| |
60-
~~~~~~~~~~~~~~~~~~~~
51+
| |
52+
| Address |
53+
| translation |
54+
| table |
55+
| |
56+
| Secondary entry |
57+
| points |
58+
|------------------|
59+
6160
```
6261

6362
### Functions table
@@ -75,28 +74,43 @@ internal offsets, and between hot and cold fragments, to better spread deltas
7574
and save space.
7675

7776
Hot indices are delta encoded, implicitly starting at zero.
78-
| Entry | Encoding | Description |
79-
| ------ | ------| ----------- |
80-
| `Address` | Continuous, Delta, ULEB128 | Function address in the output binary |
81-
| `HotIndex` | Delta, ULEB128 | Cold functions only: index of corresponding hot function in hot functions table |
82-
| `NumEntries` | ULEB128 | Number of address translation entries for a function |
83-
| `EqualElems` | ULEB128 | Hot functions only: number of equal offsets in the beginning of a function |
84-
| `BranchEntries` | Bitmask, `alignTo(EqualElems, 8)` bits | Hot functions only: if `EqualElems` is non-zero, bitmask denoting entries with `BRANCHENTRY` bit |
77+
| Entry | Encoding | Description | Hot/Cold |
78+
| ------ | ------| ----------- | ------ |
79+
| `Address` | Continuous, Delta, ULEB128 | Function address in the output binary | Both |
80+
| `HotIndex` | Delta, ULEB128 | Index of corresponding hot function in hot functions table | Cold |
81+
| `FuncHash` | 8b | Function hash for input function | Hot |
82+
| `NumBlocks` | ULEB128 | Number of basic blocks in the original function | Hot |
83+
| `NumSecEntryPoints` | ULEB128 | Number of secondary entry points in the original function | Hot |
84+
| `NumEntries` | ULEB128 | Number of address translation entries for a function | Both |
85+
| `EqualElems` | ULEB128 | Number of equal offsets in the beginning of a function | Hot |
86+
| `BranchEntries` | Bitmask, `alignTo(EqualElems, 8)` bits | If `EqualElems` is non-zero, bitmask denoting entries with `BRANCHENTRY` bit | Hot |
8587

86-
Function header is followed by `EqualElems` offsets (hot functions only) and
87-
`NumEntries-EqualElems` (`NumEntries` for cold functions) pairs of offsets for
88-
current function.
88+
Function header is followed by *Address Translation Table* with `NumEntries`
89+
total entries, and *Secondary Entry Points* table with `NumSecEntryPoints`
90+
entries (hot functions only).
8991

9092
### Address translation table
9193
Delta encoding means that only the difference with the previous corresponding
9294
entry is encoded. Input offsets implicitly start at zero.
93-
| Entry | Encoding | Description |
94-
| ------ | ------| ----------- |
95-
| `OutputOffset` | Continuous, Delta, ULEB128 | Function offset in output binary |
96-
| `InputOffset` | Optional, Delta, SLEB128 | Function offset in input binary with `BRANCHENTRY` LSB bit |
95+
| Entry | Encoding | Description | Branch/BB |
96+
| ------ | ------| ----------- | ------ |
97+
| `OutputOffset` | Continuous, Delta, ULEB128 | Function offset in output binary | Both |
98+
| `InputOffset` | Optional, Delta, SLEB128 | Function offset in input binary with `BRANCHENTRY` LSB bit | Both |
99+
| `BBHash` | Optional, 8b | Basic block hash in input binary | BB |
100+
| `BBIdx` | Optional, Delta, ULEB128 | Basic block index in input binary | BB |
101+
102+
For hot fragments, the table omits the first `EqualElems` input offsets
103+
where the input offset equals output offset.
97104

98105
`BRANCHENTRY` bit denotes whether a given offset pair is a control flow source
99106
(branch or call instruction). If not set, it signifies a control flow target
100107
(basic block offset).
101108
`InputAddr` is omitted for equal offsets in input and output function. In this
102109
case, `BRANCHENTRY` bits are encoded separately in a `BranchEntries` bitvector.
110+
111+
### Secondary Entry Points table
112+
The table is emitted for hot fragments only. It contains `NumSecEntryPoints`
113+
offsets denoting secondary entry points, delta encoded, implicitly starting at zero.
114+
| Entry | Encoding | Description |
115+
| ----- | -------- | ----------- |
116+
| `SecEntryPoint` | Delta, ULEB128 | Secondary entry point offset |

bolt/include/bolt/Core/DebugNames.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,16 @@ class DWARF5AcceleratorTable {
6868
std::unique_ptr<DebugBufferVector> releaseBuffer() {
6969
return std::move(FullTableBuffer);
7070
}
71+
/// Adds a DIE that is referenced across CUs.
72+
void addCrossCUDie(const DIE *Die) {
73+
CrossCUDies.insert({Die->getOffset(), Die});
74+
}
75+
/// Returns true if the DIE can generate an entry for a cross cu reference.
76+
/// This only checks TAGs of a DIE because when this is invoked DIE might not
77+
/// be fully constructed.
78+
bool canGenerateEntryWithCrossCUReference(
79+
const DWARFUnit &Unit, const DIE &Die,
80+
const DWARFAbbreviationDeclaration::AttributeSpec &AttrSpec);
7181

7282
private:
7383
BinaryContext &BC;
@@ -128,6 +138,7 @@ class DWARF5AcceleratorTable {
128138
llvm::DenseMap<uint64_t, uint32_t> CUOffsetsToPatch;
129139
// Contains a map of Entry ID to Entry relative offset.
130140
llvm::DenseMap<uint64_t, uint32_t> EntryRelativeOffsets;
141+
llvm::DenseMap<uint64_t, const DIE *> CrossCUDies;
131142
/// Adds Unit to either CUList, LocalTUList or ForeignTUList.
132143
/// Input Unit being processed, and DWO ID if Unit is being processed comes
133144
/// from a DWO section.

bolt/include/bolt/Core/MCPlus.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ class MCAnnotation {
7373
kOffset, /// Offset in the function.
7474
kLabel, /// MCSymbol pointing to this instruction.
7575
kSize, /// Size of the instruction.
76+
kDynamicBranch, /// Jit instruction patched at runtime.
7677
kGeneric /// First generic annotation.
7778
};
7879

0 commit comments

Comments
 (0)