Skip to content

Commit fa56440

Browse files
committed
Merge branch 'llvm:main' into users/dansuh17
2 parents d522b1b + 27595c4 commit fa56440

File tree

1,120 files changed

+45601
-43698
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,120 files changed

+45601
-43698
lines changed

.github/new-prs-labeler.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ mlir:dlti:
239239
- mlir/**/DLTI/**
240240

241241
mlir:emitc:
242-
- mlir/**/EmitC/**
242+
- mlir/**/*EmitC*/**
243243
- mlir/lib/Target/Cpp/**
244244

245245
mlir:func:
@@ -306,7 +306,7 @@ mlir:tensor:
306306
- mlir/**/Tensor/**
307307

308308
mlir:tosa:
309-
- mlir/**/Tosa/**
309+
- mlir/**/*Tosa*/**
310310

311311
mlir:ub:
312312
- mlir/**/UB/**

.github/workflows/release-doxygen.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ jobs:
5656
pip3 install --user -r ./llvm/docs/requirements.txt
5757
5858
- name: Build Doxygen
59-
env:
60-
GITHUB_TOKEN: ${{ github.token }}
6159
run: |
6260
./llvm/utils/release/build-docs.sh -release "${{ inputs.release-version }}" -no-sphinx
6361
6462
- name: Upload Doxygen
6563
if: env.upload
64+
env:
65+
GITHUB_TOKEN: ${{ github.token }}
6666
run: |
6767
./llvm/utils/release/github-upload-release.py --token "$GITHUB_TOKEN" --release "${{ inputs.release-version }}" --user "${{ github.actor }}" upload --files ./*doxygen*.tar.xz

.github/workflows/release-tasks.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Release Task
22

33
permissions:
4-
contents: write
4+
contents: read
55

66
on:
77
push:
@@ -27,6 +27,8 @@ jobs:
2727
release-create:
2828
name: Create a New Release
2929
runs-on: ubuntu-latest
30+
permissions:
31+
contents: write # For creating the release.
3032
needs: validate-tag
3133

3234
steps:
@@ -55,6 +57,8 @@ jobs:
5557

5658
release-doxygen:
5759
name: Build and Upload Release Doxygen
60+
permissions:
61+
contents: write
5862
needs:
5963
- validate-tag
6064
- release-create
@@ -72,6 +76,8 @@ jobs:
7276

7377
release-binaries:
7478
name: Build Release Binaries
79+
permissions:
80+
contents: write
7581
needs:
7682
- validate-tag
7783
- release-create

bolt/include/bolt/Passes/IndirectCallPromotion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class IndirectCallPromotion : public BinaryFunctionPass {
104104
struct Location {
105105
MCSymbol *Sym{nullptr};
106106
uint64_t Addr{0};
107-
bool isValid() const { return Sym || (!Sym && Addr != 0); }
107+
bool isValid() const { return Sym || Addr != 0; }
108108
Location() {}
109109
explicit Location(MCSymbol *Sym) : Sym(Sym) {}
110110
explicit Location(uint64_t Addr) : Addr(Addr) {}

bolt/lib/Passes/BinaryPasses.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -910,6 +910,11 @@ uint64_t SimplifyConditionalTailCalls::fixTailCalls(BinaryFunction &BF) {
910910
auto &CTCAnnotation =
911911
MIB->getOrCreateAnnotationAs<uint64_t>(*CondBranch, "CTCTakenCount");
912912
CTCAnnotation = CTCTakenFreq;
913+
// Preserve Offset annotation, used in BAT.
914+
// Instr is a direct tail call instruction that was created when CTCs are
915+
// first expanded, and has the original CTC offset set.
916+
if (std::optional<uint32_t> Offset = MIB->getOffset(*Instr))
917+
MIB->setOffset(*CondBranch, *Offset);
913918

914919
// Remove the unused successor which may be eliminated later
915920
// if there are no other users.

bolt/lib/Profile/DataAggregator.cpp

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "llvm/ADT/STLExtras.h"
2424
#include "llvm/ADT/ScopeExit.h"
2525
#include "llvm/Support/CommandLine.h"
26+
#include "llvm/Support/Compiler.h"
2627
#include "llvm/Support/Debug.h"
2728
#include "llvm/Support/Errc.h"
2829
#include "llvm/Support/FileSystem.h"
@@ -1999,7 +2000,7 @@ std::error_code DataAggregator::parseMMapEvents() {
19992000
std::pair<StringRef, MMapInfo> FileMMapInfo = FileMMapInfoRes.get();
20002001
if (FileMMapInfo.second.PID == -1)
20012002
continue;
2002-
if (FileMMapInfo.first.equals("(deleted)"))
2003+
if (FileMMapInfo.first == "(deleted)")
20032004
continue;
20042005

20052006
// Consider only the first mapping of the file for any given PID
@@ -2339,7 +2340,7 @@ std::error_code DataAggregator::writeBATYAML(BinaryContext &BC,
23392340
continue;
23402341
BinaryFunction *BF = BC.getBinaryFunctionAtAddress(FuncAddress);
23412342
assert(BF);
2342-
YamlBF.Name = FuncName.str();
2343+
YamlBF.Name = getLocationName(*BF);
23432344
YamlBF.Id = BF->getFunctionNumber();
23442345
YamlBF.Hash = BAT->getBFHash(FuncAddress);
23452346
YamlBF.ExecCount = BF->getKnownExecutionCount();
@@ -2378,21 +2379,27 @@ std::error_code DataAggregator::writeBATYAML(BinaryContext &BC,
23782379
return CSI;
23792380
};
23802381

2382+
// Lookup containing basic block offset and index
2383+
auto getBlock = [&BlockMap](uint32_t Offset) {
2384+
auto BlockIt = BlockMap.upper_bound(Offset);
2385+
if (LLVM_UNLIKELY(BlockIt == BlockMap.begin())) {
2386+
errs() << "BOLT-ERROR: invalid BAT section\n";
2387+
exit(1);
2388+
}
2389+
--BlockIt;
2390+
return std::pair(BlockIt->first, BlockIt->second.getBBIndex());
2391+
};
2392+
23812393
for (const auto &[FromOffset, SuccKV] : Branches.IntraIndex) {
2382-
if (!BlockMap.isInputBlock(FromOffset))
2383-
continue;
2384-
const unsigned Index = BlockMap.getBBIndex(FromOffset);
2394+
const auto &[_, Index] = getBlock(FromOffset);
23852395
yaml::bolt::BinaryBasicBlockProfile &YamlBB = YamlBF.Blocks[Index];
23862396
for (const auto &[SuccOffset, SuccDataIdx] : SuccKV)
23872397
if (BlockMap.isInputBlock(SuccOffset))
23882398
YamlBB.Successors.emplace_back(
23892399
getSuccessorInfo(SuccOffset, SuccDataIdx));
23902400
}
23912401
for (const auto &[FromOffset, CallTo] : Branches.InterIndex) {
2392-
auto BlockIt = BlockMap.upper_bound(FromOffset);
2393-
--BlockIt;
2394-
const unsigned BlockOffset = BlockIt->first;
2395-
const unsigned BlockIndex = BlockIt->second.getBBIndex();
2402+
const auto &[BlockOffset, BlockIndex] = getBlock(FromOffset);
23962403
yaml::bolt::BinaryBasicBlockProfile &YamlBB = YamlBF.Blocks[BlockIndex];
23972404
const uint32_t Offset = FromOffset - BlockOffset;
23982405
for (const auto &[CallToLoc, CallToIdx] : CallTo)
@@ -2403,6 +2410,17 @@ std::error_code DataAggregator::writeBATYAML(BinaryContext &BC,
24032410
return A.Offset < B.Offset;
24042411
});
24052412
}
2413+
// Set entry counts, similar to DataReader::readProfile.
2414+
for (const llvm::bolt::BranchInfo &BI : Branches.EntryData) {
2415+
if (!BlockMap.isInputBlock(BI.To.Offset)) {
2416+
if (opts::Verbosity >= 1)
2417+
errs() << "BOLT-WARNING: Unexpected EntryData in " << FuncName
2418+
<< " at 0x" << Twine::utohexstr(BI.To.Offset) << '\n';
2419+
continue;
2420+
}
2421+
const unsigned BlockIndex = BlockMap.getBBIndex(BI.To.Offset);
2422+
YamlBF.Blocks[BlockIndex].ExecCount += BI.Branches;
2423+
}
24062424
// Drop blocks without a hash, won't be useful for stale matching.
24072425
llvm::erase_if(YamlBF.Blocks,
24082426
[](const yaml::bolt::BinaryBasicBlockProfile &YamlBB) {

bolt/lib/Profile/DataReader.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,8 +1205,7 @@ std::error_code DataReader::parse() {
12051205

12061206
// Add entry data for branches to another function or branches
12071207
// to entry points (including recursive calls)
1208-
if (BI.To.IsSymbol &&
1209-
(!BI.From.Name.equals(BI.To.Name) || BI.To.Offset == 0)) {
1208+
if (BI.To.IsSymbol && (BI.From.Name != BI.To.Name || BI.To.Offset == 0)) {
12101209
I = GetOrCreateFuncEntry(BI.To.Name);
12111210
I->second.EntryData.emplace_back(std::move(BI));
12121211
}

bolt/lib/Rewrite/DWARFRewriter.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,7 +1550,7 @@ CUOffsetMap DWARFRewriter::finalizeTypeSections(DIEBuilder &DIEBlder,
15501550
for (const SectionRef &Section : Obj->sections()) {
15511551
StringRef Contents = cantFail(Section.getContents());
15521552
StringRef Name = cantFail(Section.getName());
1553-
if (Name.equals(".debug_types"))
1553+
if (Name == ".debug_types")
15541554
BC.registerOrUpdateNoteSection(".debug_types", copyByteArray(Contents),
15551555
Contents.size());
15561556
}
@@ -1633,10 +1633,10 @@ void DWARFRewriter::finalizeDebugSections(
16331633
for (const SectionRef &Secs : Obj->sections()) {
16341634
StringRef Contents = cantFail(Secs.getContents());
16351635
StringRef Name = cantFail(Secs.getName());
1636-
if (Name.equals(".debug_abbrev")) {
1636+
if (Name == ".debug_abbrev") {
16371637
BC.registerOrUpdateNoteSection(".debug_abbrev", copyByteArray(Contents),
16381638
Contents.size());
1639-
} else if (Name.equals(".debug_info")) {
1639+
} else if (Name == ".debug_info") {
16401640
BC.registerOrUpdateNoteSection(".debug_info", copyByteArray(Contents),
16411641
Contents.size());
16421642
}
@@ -1771,7 +1771,7 @@ std::optional<StringRef> updateDebugData(
17711771
};
17721772
switch (SectionIter->second.second) {
17731773
default: {
1774-
if (!SectionName.equals("debug_str.dwo"))
1774+
if (SectionName != "debug_str.dwo")
17751775
errs() << "BOLT-WARNING: unsupported debug section: " << SectionName
17761776
<< "\n";
17771777
return SectionContents;
@@ -1959,7 +1959,7 @@ void DWARFRewriter::updateDWP(DWARFUnit &CU,
19591959
continue;
19601960
}
19611961

1962-
if (SectionName.equals("debug_str.dwo")) {
1962+
if (SectionName == "debug_str.dwo") {
19631963
CurStrSection = OutData;
19641964
} else {
19651965
// Since handleDebugDataPatching returned true, we already know this is

bolt/lib/Rewrite/SDTRewriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ void SDTRewriter::readSection() {
8787

8888
StringRef Name = DE.getCStr(&Offset);
8989

90-
if (!Name.equals("stapsdt"))
90+
if (Name != "stapsdt")
9191
errs() << "BOLT-WARNING: SDT note name \"" << Name
9292
<< "\" is not expected\n";
9393

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
B 80010c 800194 1 0

0 commit comments

Comments
 (0)