Skip to content

Commit 6895d20

Browse files
committed
merge main into amd-staging
revert: [LLVM] Silence compiler-rt warning in runtimes build (llvm#99525) revert: 72ff049 [ValueTracking] Consistently propagate `DemandedElts` is `isKnownNonZero` Change-Id: Ifb72990d2870037f00d502a0ccbd1bebef7cb1d7
2 parents 12c9360 + 615b7ee commit 6895d20

File tree

1,006 files changed

+35238
-14550
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,006 files changed

+35238
-14550
lines changed

.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 }}

bolt/docs/CommandLineArgumentReference.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "llvm/MC/MCContext.h"
3333
#include "llvm/MC/MCObjectFileInfo.h"
3434
#include "llvm/MC/MCObjectWriter.h"
35+
#include "llvm/MC/MCPseudoProbe.h"
3536
#include "llvm/MC/MCSectionELF.h"
3637
#include "llvm/MC/MCSectionMachO.h"
3738
#include "llvm/MC/MCStreamer.h"
@@ -246,6 +247,9 @@ class BinaryContext {
246247
/// DWP Context.
247248
std::shared_ptr<DWARFContext> DWPContext;
248249

250+
/// Decoded pseudo probes.
251+
std::shared_ptr<MCPseudoProbeDecoder> PseudoProbeDecoder;
252+
249253
/// A map of DWO Ids to CUs.
250254
using DWOIdToCUMapType = std::unordered_map<uint64_t, DWARFUnit *>;
251255
DWOIdToCUMapType DWOCUs;
@@ -377,6 +381,15 @@ class BinaryContext {
377381
RtLibrary = std::move(Lib);
378382
}
379383

384+
const MCPseudoProbeDecoder *getPseudoProbeDecoder() const {
385+
return PseudoProbeDecoder.get();
386+
}
387+
388+
void setPseudoProbeDecoder(std::shared_ptr<MCPseudoProbeDecoder> Decoder) {
389+
assert(!PseudoProbeDecoder && "Cannot set pseudo probe decoder twice.");
390+
PseudoProbeDecoder = Decoder;
391+
}
392+
380393
/// Return BinaryFunction containing a given \p Address or nullptr if
381394
/// no registered function contains the \p Address.
382395
///
@@ -431,6 +444,9 @@ class BinaryContext {
431444
return nullptr;
432445
}
433446

447+
/// Deregister JumpTable registered at a given \p Address and delete it.
448+
void deleteJumpTable(uint64_t Address);
449+
434450
unsigned getDWARFEncodingSize(unsigned Encoding) {
435451
if (Encoding == dwarf::DW_EH_PE_omit)
436452
return 0;

bolt/include/bolt/Core/BinaryFunction.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,9 @@ class BinaryFunction {
416416
/// different parameters by every pass.
417417
mutable uint64_t Hash{0};
418418

419+
/// Function GUID assigned externally.
420+
uint64_t GUID{0};
421+
419422
/// For PLT functions it contains a symbol associated with a function
420423
/// reference. It is nullptr for non-PLT functions.
421424
const MCSymbol *PLTSymbol{nullptr};
@@ -2256,6 +2259,11 @@ class BinaryFunction {
22562259
/// Returns the last computed hash value of the function.
22572260
size_t getHash() const { return Hash; }
22582261

2262+
/// Returns the function GUID.
2263+
uint64_t getGUID() const { return GUID; }
2264+
2265+
void setGUID(uint64_t Id) { GUID = Id; }
2266+
22592267
using OperandHashFuncTy =
22602268
function_ref<typename std::string(const MCOperand &)>;
22612269

bolt/include/bolt/Core/MCPlusBuilder.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ enum class IndirectBranchType : char {
5858
POSSIBLE_PIC_JUMP_TABLE, /// Possibly a jump table for PIC.
5959
POSSIBLE_GOTO, /// Possibly a gcc's computed goto.
6060
POSSIBLE_FIXED_BRANCH, /// Possibly an indirect branch to a fixed location.
61+
POSSIBLE_PIC_FIXED_BRANCH, /// Possibly an indirect jump to a fixed entry in a
62+
/// PIC jump table.
6163
};
6264

6365
class MCPlusBuilder {
@@ -1474,12 +1476,11 @@ class MCPlusBuilder {
14741476
/// will be set to the different components of the branch. \p MemLocInstr
14751477
/// is the instruction that loads up the indirect function pointer. It may
14761478
/// or may not be same as \p Instruction.
1477-
virtual IndirectBranchType
1478-
analyzeIndirectBranch(MCInst &Instruction, InstructionIterator Begin,
1479-
InstructionIterator End, const unsigned PtrSize,
1480-
MCInst *&MemLocInstr, unsigned &BaseRegNum,
1481-
unsigned &IndexRegNum, int64_t &DispValue,
1482-
const MCExpr *&DispExpr, MCInst *&PCRelBaseOut) const {
1479+
virtual IndirectBranchType analyzeIndirectBranch(
1480+
MCInst &Instruction, InstructionIterator Begin, InstructionIterator End,
1481+
const unsigned PtrSize, MCInst *&MemLocInstr, unsigned &BaseRegNum,
1482+
unsigned &IndexRegNum, int64_t &DispValue, const MCExpr *&DispExpr,
1483+
MCInst *&PCRelBaseOut, MCInst *&FixedEntryLoadInst) const {
14831484
llvm_unreachable("not implemented");
14841485
return IndirectBranchType::UNKNOWN;
14851486
}

bolt/include/bolt/Profile/ProfileYAMLMapping.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,36 @@ template <> struct MappingTraits<bolt::SuccessorInfo> {
9393
static const bool flow = true;
9494
};
9595

96+
namespace bolt {
97+
struct PseudoProbeInfo {
98+
llvm::yaml::Hex64 GUID;
99+
uint64_t Index;
100+
uint8_t Type;
101+
102+
bool operator==(const PseudoProbeInfo &Other) const {
103+
return GUID == Other.GUID && Index == Other.Index;
104+
}
105+
bool operator!=(const PseudoProbeInfo &Other) const {
106+
return !(*this == Other);
107+
}
108+
};
109+
} // end namespace bolt
110+
111+
template <> struct MappingTraits<bolt::PseudoProbeInfo> {
112+
static void mapping(IO &YamlIO, bolt::PseudoProbeInfo &PI) {
113+
YamlIO.mapRequired("guid", PI.GUID);
114+
YamlIO.mapRequired("id", PI.Index);
115+
YamlIO.mapRequired("type", PI.Type);
116+
}
117+
118+
static const bool flow = true;
119+
};
96120
} // end namespace yaml
97121
} // end namespace llvm
98122

99123
LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(llvm::yaml::bolt::CallSiteInfo)
100124
LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(llvm::yaml::bolt::SuccessorInfo)
125+
LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(llvm::yaml::bolt::PseudoProbeInfo)
101126

102127
namespace llvm {
103128
namespace yaml {
@@ -111,6 +136,7 @@ struct BinaryBasicBlockProfile {
111136
uint64_t EventCount{0};
112137
std::vector<CallSiteInfo> CallSites;
113138
std::vector<SuccessorInfo> Successors;
139+
std::vector<PseudoProbeInfo> PseudoProbes;
114140

115141
bool operator==(const BinaryBasicBlockProfile &Other) const {
116142
return Index == Other.Index;
@@ -132,6 +158,8 @@ template <> struct MappingTraits<bolt::BinaryBasicBlockProfile> {
132158
std::vector<bolt::CallSiteInfo>());
133159
YamlIO.mapOptional("succ", BBP.Successors,
134160
std::vector<bolt::SuccessorInfo>());
161+
YamlIO.mapOptional("pseudo_probes", BBP.PseudoProbes,
162+
std::vector<bolt::PseudoProbeInfo>());
135163
}
136164
};
137165

@@ -151,6 +179,8 @@ struct BinaryFunctionProfile {
151179
llvm::yaml::Hex64 Hash{0};
152180
uint64_t ExecCount{0};
153181
std::vector<BinaryBasicBlockProfile> Blocks;
182+
llvm::yaml::Hex64 GUID{0};
183+
llvm::yaml::Hex64 PseudoProbeDescHash{0};
154184
bool Used{false};
155185
};
156186
} // end namespace bolt
@@ -164,6 +194,9 @@ template <> struct MappingTraits<bolt::BinaryFunctionProfile> {
164194
YamlIO.mapRequired("nblocks", BFP.NumBasicBlocks);
165195
YamlIO.mapOptional("blocks", BFP.Blocks,
166196
std::vector<bolt::BinaryBasicBlockProfile>());
197+
YamlIO.mapOptional("guid", BFP.GUID, (uint64_t)0);
198+
YamlIO.mapOptional("pseudo_probe_desc_hash", BFP.PseudoProbeDescHash,
199+
(uint64_t)0);
167200
}
168201
};
169202

0 commit comments

Comments
 (0)