Skip to content

Commit a070e3c

Browse files
committed
Merge branch 'main' into pauth-gnuprop-readobj
2 parents 8a37522 + 373e77b commit a070e3c

File tree

2,225 files changed

+95257
-25522
lines changed

Some content is hidden

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

2,225 files changed

+95257
-25522
lines changed

.github/CODEOWNERS

Lines changed: 21 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
@@ -106,8 +107,21 @@ clang/test/AST/Interp/ @tbaederr
106107
# MLIR Sparsifier.
107108
/mlir/**/*SparseTensor*/ @aartbik @PeimingLiu @yinying-lisa-li @matthias-springer
108109

110+
# MLIR NVGPU Dialect
111+
/mlir/**/NVGPU*/ @grypp
112+
/mlir/test/**/CUDA/ @grypp
113+
114+
# MLIR NVVM Dialect in MLIR
115+
/mlir/**/LLVMIR/**/BasicPtxBuilderInterface* @grypp
116+
/mlir/**/NVVM*/ @grypp
117+
109118
# BOLT
110119
/bolt/ @aaupov @maksfb @rafaelauler @ayermolo @dcci
111120

112121
# Bazel build system.
113122
/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/llvm-tests.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ jobs:
4242
BASELINE_REF: ${{ steps.vars.outputs.BASELINE_REF }}
4343
ABI_HEADERS: ${{ steps.vars.outputs.ABI_HEADERS }}
4444
BASELINE_VERSION_MAJOR: ${{ steps.vars.outputs.BASELINE_VERSION_MAJOR }}
45+
BASELINE_VERSION_MINOR: ${{ steps.vars.outputs.BASELINE_VERSION_MINOR }}
4546
LLVM_VERSION_MAJOR: ${{ steps.version.outputs.LLVM_VERSION_MAJOR }}
4647
LLVM_VERSION_MINOR: ${{ steps.version.outputs.LLVM_VERSION_MINOR }}
4748
LLVM_VERSION_PATCH: ${{ steps.version.outputs.LLVM_VERSION_PATCH }}
@@ -58,7 +59,14 @@ jobs:
5859
- name: Setup Variables
5960
id: vars
6061
run: |
61-
if [ ${{ steps.version.outputs.LLVM_VERSION_MINOR }} -ne 0 ] || [ ${{ steps.version.outputs.LLVM_VERSION_PATCH }} -eq 0 ]; then
62+
# C++ ABI:
63+
# 18.1.0 we aren't doing ABI checks.
64+
# 18.1.1 We want to check 18.1.0.
65+
# C ABI:
66+
# 18.1.0 We want to check 17.0.x
67+
# 18.1.1 We want to check 18.1.0
68+
echo "BASELINE_VERSION_MINOR=1" >> "$GITHUB_OUTPUT"
69+
if [ ${{ steps.version.outputs.LLVM_VERSION_PATCH }} -eq 0 ]; then
6270
{
6371
echo "BASELINE_VERSION_MAJOR=$(( ${{ steps.version.outputs.LLVM_VERSION_MAJOR }} - 1))"
6472
echo "ABI_HEADERS=llvm-c"
@@ -82,7 +90,7 @@ jobs:
8290
include:
8391
- name: build-baseline
8492
llvm_version_major: ${{ needs.abi-dump-setup.outputs.BASELINE_VERSION_MAJOR }}
85-
ref: llvmorg-${{ needs.abi-dump-setup.outputs.BASELINE_VERSION_MAJOR }}.0.0
93+
ref: llvmorg-${{ needs.abi-dump-setup.outputs.BASELINE_VERSION_MAJOR }}.${{ needs.abi-dump-setup.outputs.BASELINE_VERSION_MINOR }}.0
8694
repo: llvm/llvm-project
8795
- name: build-latest
8896
llvm_version_major: ${{ needs.abi-dump-setup.outputs.LLVM_VERSION_MAJOR }}

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

Lines changed: 13 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
@@ -77,8 +75,16 @@ jobs:
7775
# the merge base.
7876
run: |
7977
python ./code-format-tools/llvm/utils/git/code-format-helper.py \
78+
--write-comment-to-file \
8079
--token ${{ secrets.GITHUB_TOKEN }} \
8180
--issue-number $GITHUB_PR_NUMBER \
8281
--start-rev $(git merge-base $START_REV $END_REV) \
8382
--end-rev $END_REV \
8483
--changed-files "$CHANGED_FILES"
84+
85+
- uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0
86+
if: always()
87+
with:
88+
name: workflow-args
89+
path: |
90+
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: 10 additions & 7 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
@@ -79,6 +78,8 @@ Hot indices are delta encoded, implicitly starting at zero.
7978
| ------ | ------| ----------- |
8079
| `Address` | Continuous, Delta, ULEB128 | Function address in the output binary |
8180
| `HotIndex` | Delta, ULEB128 | Cold functions only: index of corresponding hot function in hot functions table |
81+
| `FuncHash` | 8b | Hot functions only: function hash for input function |
82+
| `NumBlocks` | ULEB128 | Hot functions only: number of basic blocks in the original function |
8283
| `NumEntries` | ULEB128 | Number of address translation entries for a function |
8384
| `EqualElems` | ULEB128 | Hot functions only: number of equal offsets in the beginning of a function |
8485
| `BranchEntries` | Bitmask, `alignTo(EqualElems, 8)` bits | Hot functions only: if `EqualElems` is non-zero, bitmask denoting entries with `BRANCHENTRY` bit |
@@ -90,10 +91,12 @@ current function.
9091
### Address translation table
9192
Delta encoding means that only the difference with the previous corresponding
9293
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 |
94+
| Entry | Encoding | Description | Branch/BB |
95+
| ------ | ------| ----------- | ------ |
96+
| `OutputOffset` | Continuous, Delta, ULEB128 | Function offset in output binary | Both |
97+
| `InputOffset` | Optional, Delta, SLEB128 | Function offset in input binary with `BRANCHENTRY` LSB bit | Both |
98+
| `BBHash` | Optional, 8b | Basic block hash in input binary | BB |
99+
| `BBIdx` | Optional, Delta, ULEB128 | Basic block index in input binary | BB |
97100

98101
`BRANCHENTRY` bit denotes whether a given offset pair is a control flow source
99102
(branch or call instruction). If not set, it signifies a control flow target

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

bolt/include/bolt/Core/MCPlusBuilder.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,6 +1199,16 @@ class MCPlusBuilder {
11991199
/// Set instruction size.
12001200
void setSize(MCInst &Inst, uint32_t Size) const;
12011201

1202+
/// Check if the branch instruction could be modified at runtime.
1203+
bool isDynamicBranch(const MCInst &Inst) const;
1204+
1205+
/// Return ID for runtime-modifiable instruction.
1206+
std::optional<uint32_t> getDynamicBranchID(const MCInst &Inst) const;
1207+
1208+
/// Mark instruction as a dynamic branch, i.e. a branch that can be
1209+
/// overwritten at runtime.
1210+
void setDynamicBranch(MCInst &Inst, uint32_t ID) const;
1211+
12021212
/// Return MCSymbol that represents a target of this instruction at a given
12031213
/// operand number \p OpNum. If there's no symbol associated with
12041214
/// the operand - return nullptr.
@@ -1688,6 +1698,13 @@ class MCPlusBuilder {
16881698
llvm_unreachable("not implemented");
16891699
}
16901700

1701+
/// Create long conditional branch with a target-specific conditional code
1702+
/// \p CC.
1703+
virtual void createLongCondBranch(MCInst &Inst, const MCSymbol *Target,
1704+
unsigned CC, MCContext *Ctx) const {
1705+
llvm_unreachable("not implemented");
1706+
}
1707+
16911708
/// Reverses the branch condition in Inst and update its taken target to TBB.
16921709
///
16931710
/// Returns true on success.

0 commit comments

Comments
 (0)