Skip to content

Commit 64325d5

Browse files
committed
Merge branch 'main' into ptrauth-init-fini
2 parents 13611b0 + 2eea9d6 commit 64325d5

File tree

1,216 files changed

+51018
-29769
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,216 files changed

+51018
-29769
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ clang/test/AST/Interp/ @tbaederr
8686
/mlir/**/*VectorToLLVM* @banach-space @dcaballe @nicolasvasilache
8787
/mlir/**/*X86Vector* @aartbik @dcaballe @nicolasvasilache
8888
/mlir/include/mlir/Dialect/Vector @banach-space @dcaballe @nicolasvasilache
89+
/mlir/include/mlir/Dialect/Vector/IR @kuhar
8990
/mlir/lib/Dialect/Vector @banach-space @dcaballe @nicolasvasilache
9091
/mlir/lib/Dialect/Vector/Transforms/* @banach-space @dcaballe @hanhanW @nicolasvasilache
9192
/mlir/lib/Dialect/Vector/Transforms/VectorEmulateNarrowType.cpp @banach-space @dcaballe @MaheshRavishankar @nicolasvasilache

.github/workflows/issue-write.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,21 @@ jobs:
2424
github.event.workflow_run.conclusion == 'failure'
2525
)
2626
steps:
27+
- name: Fetch Sources
28+
uses: actions/checkout@v4
29+
with:
30+
sparse-checkout: |
31+
.github/workflows/unprivileged-download-artifact/action.yml
32+
sparse-checkout-cone-mode: false
2733
- name: 'Download artifact'
28-
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
34+
uses: ./.github/workflows/unprivileged-download-artifact
35+
id: download-artifact
2936
with:
30-
github-token: ${{ secrets.ISSUE_WRITE_DOWNLOAD_ARTIFACT }}
3137
run-id: ${{ github.event.workflow_run.id }}
32-
name: workflow-args
38+
artifact-name: workflow-args
3339

3440
- name: 'Comment on PR'
41+
if: steps.download-artifact.outputs.artifact-id != ''
3542
uses: actions/github-script@v3
3643
with:
3744
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -144,5 +151,7 @@ jobs:
144151
});
145152
146153
- name: Dump comments file
147-
if: always()
154+
if: >-
155+
always() &&
156+
steps.download-artifact.outputs.artifact-id != ''
148157
run: cat comments
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Unprivileged Download Artifact
2+
description: >-
3+
Download artifacts from another workflow run without using an access token.
4+
inputs:
5+
run-id:
6+
description: >-
7+
The run-id for the workflow run that you want to download the artifact
8+
from. If ommitted it will download the most recently created artifact
9+
from the repo with the artifact-name.
10+
required: false
11+
artifact-name:
12+
desciption: The name of the artifact to download.
13+
required: true
14+
15+
16+
outputs:
17+
filename:
18+
description: >-
19+
The filename of the downloaded artifact or the empty string if the
20+
artifact was not found.
21+
value: ${{ steps.download-artifact.outputs.filename }}
22+
artifact-id:
23+
description: "The id of the artifact being downloaded."
24+
value: ${{ steps.artifact-url.outputs.id }}
25+
26+
27+
runs:
28+
using: "composite"
29+
steps:
30+
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea #v7.0.1
31+
id: artifact-url
32+
with:
33+
script: |
34+
var response;
35+
if (!"${{ inputs.run-id }}") {
36+
response = await github.rest.actions.listArtifactsForRepo({
37+
owner: context.repo.owner,
38+
repo: context.repo.repo,
39+
name: "${{ inputs.artifact-name }}"
40+
})
41+
} else {
42+
response = await github.rest.actions.listWorkflowRunArtifacts({
43+
owner: context.repo.owner,
44+
repo: context.repo.repo,
45+
run_id: "${{ inputs.run-id }}",
46+
name: "${{ inputs.artifact-name }}"
47+
})
48+
}
49+
50+
console.log(response)
51+
52+
for (artifact of response.data.artifacts) {
53+
console.log(artifact);
54+
}
55+
56+
if (response.data.artifacts.length == 0) {
57+
console.log("Could not find artifact ${{ inputs.artifact-name }} for workflow run ${{ inputs.run-id }}")
58+
return;
59+
}
60+
61+
const url_response = await github.rest.actions.downloadArtifact({
62+
owner: context.repo.owner,
63+
repo: context.repo.repo,
64+
artifact_id: response.data.artifacts[0].id,
65+
archive_format: "zip"
66+
})
67+
68+
core.setOutput("url", url_response.url);
69+
core.setOutput("id", response.data.artifacts[0].id);
70+
71+
- shell: bash
72+
if: steps.artifact-url.outputs.url != ''
73+
id: download-artifact
74+
run: |
75+
curl -L -o ${{ inputs.artifact-name }}.zip "${{ steps.artifact-url.outputs.url }}"
76+
echo "filename=${{ inputs.artifact-name }}.zip" >> $GITHUB_OUTPUT
77+
78+
- shell: bash
79+
if: steps.download-artifact.outputs.filename != ''
80+
run: |
81+
unzip ${{ steps.download-artifact.outputs.filename }}

.github/workflows/version-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ jobs:
2727
2828
- name: Version Check
2929
run: |
30-
version=$(grep -o 'LLVM_VERSION_\(MAJOR\|MINOR\|PATCH\) [0-9]\+' llvm/CMakeLists.txt | cut -d ' ' -f 2 | tr "\n" "." | sed 's/.$//g')
30+
version=$(grep -o 'LLVM_VERSION_\(MAJOR\|MINOR\|PATCH\) [0-9]\+' cmake/Modules/LLVMVersion.cmake | cut -d ' ' -f 2 | tr "\n" "." | sed 's/.$//g')
3131
.github/workflows/version-check.py "$version"

bolt/docs/CommandLineArgumentReference.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888

8989
- `--comp-dir-override=<string>`
9090

91-
Overrides DW_AT_comp_dir, and provides an alterantive base location, which is
91+
Overrides DW_AT_comp_dir, and provides an alternative base location, which is
9292
used with DW_AT_dwo_name to construct a path to *.dwo files.
9393

9494
- `--create-debug-names-section`
@@ -113,11 +113,6 @@
113113

114114
Prints out offsets for abbrev and debug_info of Skeleton CUs that get patched.
115115

116-
- `--deterministic-debuginfo`
117-
118-
Disables parallel execution of tasks that may produce nondeterministic debug
119-
info
120-
121116
- `--dot-tooltip-code`
122117

123118
Add basic block instructions as tool tips on nodes
@@ -686,6 +681,10 @@
686681
threshold means fewer functions to process. E.g threshold of 90 means only top
687682
10 percent of functions with profile will be processed.
688683

684+
- `--match-with-call-graph`
685+
686+
Match functions with call graph
687+
689688
- `--memcpy1-spec=<func1,func2:cs1:cs2,func3:cs1,...>`
690689

691690
List of functions with call sites for which to specialize memcpy() for size 1

bolt/docs/OptimizingClang.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ $ cd ${TOPLEV}/stage3
4949
$ CPATH=${TOPLEV}/stage2-prof-use-lto/install/bin/
5050
$ cmake -G Ninja ${TOPLEV}/llvm -DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_BUILD_TYPE=Release \
5151
-DCMAKE_C_COMPILER=$CPATH/clang -DCMAKE_CXX_COMPILER=$CPATH/clang++ \
52+
-DLLVM_ENABLE_PROJECTS="clang" \
5253
-DLLVM_USE_LINKER=lld -DCMAKE_INSTALL_PREFIX=${TOPLEV}/stage3/install
5354
$ perf record -e cycles:u -j any,u -- ninja clang
5455
```

bolt/docs/generate_doc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def parse_bolt_options(output):
4545
cleaned_line = line.strip()
4646

4747
if cleaned_line.casefold() in map(str.casefold, section_headers):
48-
if prev_section != None: # Save last option from prev section
48+
if prev_section is not None: # Save last option from prev section
4949
add_info(sections, current_section, option, description)
5050
option, description = None, []
5151

@@ -76,7 +76,7 @@ def parse_bolt_options(output):
7676
description = [descr]
7777
if option.startswith("--print") or option.startswith("--time"):
7878
current_section = "BOLT printing options:"
79-
elif prev_section != None:
79+
elif prev_section is not None:
8080
current_section = prev_section
8181
continue
8282

bolt/include/bolt/Core/BinaryContext.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,10 +1452,7 @@ class BinaryContext {
14521452
std::unique_ptr<MCObjectWriter> OW = MAB->createObjectWriter(OS);
14531453
std::unique_ptr<MCStreamer> Streamer(TheTarget->createMCObjectStreamer(
14541454
*TheTriple, *Ctx, std::unique_ptr<MCAsmBackend>(MAB), std::move(OW),
1455-
std::unique_ptr<MCCodeEmitter>(MCE), *STI,
1456-
/* RelaxAll */ false,
1457-
/* IncrementalLinkerCompatible */ false,
1458-
/* DWARFMustBeAtTheEnd */ false));
1455+
std::unique_ptr<MCCodeEmitter>(MCE), *STI));
14591456
return Streamer;
14601457
}
14611458

bolt/include/bolt/Profile/YAMLProfileReader.h

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,59 @@ class YAMLProfileReader : public ProfileReaderBase {
4343
using ProfileLookupMap =
4444
DenseMap<uint32_t, yaml::bolt::BinaryFunctionProfile *>;
4545

46+
/// A class for matching binary functions in functions in the YAML profile.
47+
/// First, a call graph is constructed for both profiled and binary functions.
48+
/// Then functions are hashed based on the names of their callee/caller
49+
/// functions. Finally, functions are matched based on these neighbor hashes.
50+
class CallGraphMatcher {
51+
public:
52+
/// Constructs the call graphs for binary and profiled functions and
53+
/// computes neighbor hashes for binary functions.
54+
CallGraphMatcher(BinaryContext &BC, yaml::bolt::BinaryProfile &YamlBP,
55+
ProfileLookupMap &IdToYAMLBF);
56+
57+
/// Returns the YamlBFs adjacent to the parameter YamlBF in the call graph.
58+
std::optional<std::set<yaml::bolt::BinaryFunctionProfile *>>
59+
getAdjacentYamlBFs(yaml::bolt::BinaryFunctionProfile &YamlBF) {
60+
auto It = YamlBFAdjacencyMap.find(&YamlBF);
61+
return It == YamlBFAdjacencyMap.end() ? std::nullopt
62+
: std::make_optional(It->second);
63+
}
64+
65+
/// Returns the binary functions with the parameter neighbor hash.
66+
std::optional<std::vector<BinaryFunction *>>
67+
getBFsWithNeighborHash(uint64_t NeighborHash) {
68+
auto It = NeighborHashToBFs.find(NeighborHash);
69+
return It == NeighborHashToBFs.end() ? std::nullopt
70+
: std::make_optional(It->second);
71+
}
72+
73+
private:
74+
/// Adds edges to the binary function call graph given the callsites of the
75+
/// parameter function.
76+
void constructBFCG(BinaryContext &BC, yaml::bolt::BinaryProfile &YamlBP);
77+
78+
/// Using the constructed binary function call graph, computes and creates
79+
/// mappings from "neighbor hash" (composed of the function names of callee
80+
/// and caller functions of a function) to binary functions.
81+
void computeBFNeighborHashes(BinaryContext &BC);
82+
83+
/// Constructs the call graph for profile functions.
84+
void constructYAMLFCG(yaml::bolt::BinaryProfile &YamlBP,
85+
ProfileLookupMap &IdToYAMLBF);
86+
87+
/// Adjacency map for binary functions in the call graph.
88+
DenseMap<BinaryFunction *, std::set<BinaryFunction *>> BFAdjacencyMap;
89+
90+
/// Maps neighbor hashes to binary functions.
91+
DenseMap<uint64_t, std::vector<BinaryFunction *>> NeighborHashToBFs;
92+
93+
/// Adjacency map for profile functions in the call graph.
94+
DenseMap<yaml::bolt::BinaryFunctionProfile *,
95+
std::set<yaml::bolt::BinaryFunctionProfile *>>
96+
YamlBFAdjacencyMap;
97+
};
98+
4699
private:
47100
/// Adjustments for basic samples profiles (without LBR).
48101
bool NormalizeByInsnCount{false};
@@ -100,6 +153,9 @@ class YAMLProfileReader : public ProfileReaderBase {
100153
/// Matches functions using exact hash.
101154
size_t matchWithHash(BinaryContext &BC);
102155

156+
/// Matches functions using the call graph.
157+
size_t matchWithCallGraph(BinaryContext &BC);
158+
103159
/// Matches functions with similarly named profiled functions.
104160
size_t matchWithNameSimilarity(BinaryContext &BC);
105161

bolt/lib/Core/BinaryContext.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ PrintMemData("print-mem-data",
7171

7272
cl::opt<std::string> CompDirOverride(
7373
"comp-dir-override",
74-
cl::desc("overrides DW_AT_comp_dir, and provides an alterantive base "
74+
cl::desc("overrides DW_AT_comp_dir, and provides an alternative base "
7575
"location, which is used with DW_AT_dwo_name to construct a path "
7676
"to *.dwo files."),
7777
cl::Hidden, cl::init(""), cl::cat(BoltCategory));
@@ -2367,10 +2367,7 @@ BinaryContext::calculateEmittedSize(BinaryFunction &BF, bool FixBranches) {
23672367
std::unique_ptr<MCObjectWriter> OW = MAB->createObjectWriter(VecOS);
23682368
std::unique_ptr<MCStreamer> Streamer(TheTarget->createMCObjectStreamer(
23692369
*TheTriple, *LocalCtx, std::unique_ptr<MCAsmBackend>(MAB), std::move(OW),
2370-
std::unique_ptr<MCCodeEmitter>(MCEInstance.MCE.release()), *STI,
2371-
/*RelaxAll=*/false,
2372-
/*IncrementalLinkerCompatible=*/false,
2373-
/*DWARFMustBeAtTheEnd=*/false));
2370+
std::unique_ptr<MCCodeEmitter>(MCEInstance.MCE.release()), *STI));
23742371

23752372
Streamer->initSections(false, *STI);
23762373

bolt/lib/Passes/AsmDump.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,8 @@ void dumpFunction(const BinaryFunction &BF) {
139139
auto FOut = std::make_unique<formatted_raw_ostream>(OS);
140140
FOut->SetUnbuffered();
141141
std::unique_ptr<MCStreamer> AsmStreamer(
142-
createAsmStreamer(*LocalCtx, std::move(FOut),
143-
/*isVerboseAsm=*/true,
144-
/*useDwarfDirectory=*/false, InstructionPrinter,
145-
std::move(MCEInstance.MCE), std::move(MAB),
146-
/*ShowInst=*/false));
142+
createAsmStreamer(*LocalCtx, std::move(FOut), InstructionPrinter,
143+
std::move(MCEInstance.MCE), std::move(MAB)));
147144
AsmStreamer->initSections(true, *BC.STI);
148145
std::unique_ptr<TargetMachine> TM(BC.TheTarget->createTargetMachine(
149146
BC.TripleName, "", "", TargetOptions(), std::nullopt));

0 commit comments

Comments
 (0)