Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into disable-block-signatu…
Browse files Browse the repository at this point in the history
…re-string
  • Loading branch information
ahatanak committed Jul 8, 2024
2 parents 5c88e7a + d3cb277 commit bcffdcc
Show file tree
Hide file tree
Showing 3,581 changed files with 151,548 additions and 53,558 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ clang/test/AST/Interp/ @tbaederr
/mlir/**/LLVMIR/**/BasicPtxBuilderInterface* @grypp
/mlir/**/NVVM* @grypp

# MLIR Index Dialect
/mlir/**/Index* @mogball

# MLIR Python Bindings
/mlir/test/python/ @ftynse @makslevental @stellaraccident
/mlir/python/ @ftynse @makslevental @stellaraccident
Expand Down
23 changes: 23 additions & 0 deletions .github/new-prs-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,29 @@ backend:AArch64:
- clang/include/clang/Sema/SemaARM.h
- clang/lib/Sema/SemaARM.cpp

backend:Hexagon:
- clang/include/clang/Basic/BuiltinsHexagon*.def
- clang/include/clang/Sema/SemaHexagon.h
- clang/lib/Basic/Targets/Hexagon.*
- clang/lib/CodeGen/Targets/Hexagon.cpp
- clang/lib/Driver/ToolChains/Hexagon.*
- clang/lib/Sema/SemaHexagon.cpp
- lld/ELF/Arch/Hexagon.cpp
- lldb/source/Plugins/ABI/Hexagon/**
- lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/**
- llvm/include/llvm/BinaryFormat/ELFRelocs/Hexagon.def
- llvm/include/llvm/IR/IntrinsicsHexagon*
- llvm/include/llvm/Support/Hexagon*
- llvm/lib/Support/Hexagon*
- llvm/lib/Target/Hexagon/**
- llvm/test/CodeGen/Hexagon/**
- llvm/test/CodeGen/*/Hexagon/**
- llvm/test/DebugInfo/*/Hexagon/**
- llvm/test/Transforms/*/Hexagon
- llvm/test/MC/Disassembler/Hexagon/**
- llvm/test/MC/Hexagon/**
- llvm/test/tools/llvm-objdump/ELF/Hexagon/**

backend:loongarch:
- llvm/include/llvm/IR/IntrinsicsLoongArch.td
- llvm/test/MC/LoongArch/**
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/issue-write.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
workflows:
- "Check code formatting"
- "Check for private emails used in PRs"
- "PR Request Release Note"
types:
- completed

Expand All @@ -17,7 +18,11 @@ jobs:
permissions:
pull-requests: write
if: >
github.event.workflow_run.event == 'pull_request'
github.event.workflow_run.event == 'pull_request' &&
(
github.event.workflow_run.conclusion == 'success' ||
github.event.workflow_run.conclusion == 'failure'
)
steps:
- name: 'Download artifact'
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
Expand Down Expand Up @@ -92,7 +97,11 @@ jobs:
var pr_number = 0;
gql_result.repository.ref.associatedPullRequests.nodes.forEach((pr) => {
if (pr.baseRepository.owner.login = context.repo.owner && pr.state == 'OPEN') {
// The largest PR number is the one we care about. The only way
// to have more than one associated pull requests is if all the
// old pull requests are in the closed state.
if (pr.baseRepository.owner.login = context.repo.owner && pr.number > pr_number) {
pr_number = pr.number;
}
});
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/libcxx-build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ jobs:
cxx: [ 'clang++-19' ]
include:
- config: 'generic-gcc'
cc: 'gcc-13'
cxx: 'g++-13'
cc: 'gcc-14'
cxx: 'g++-14'
steps:
- uses: actions/checkout@v4
- name: ${{ matrix.config }}.${{ matrix.cxx }}
Expand Down Expand Up @@ -101,8 +101,8 @@ jobs:
cxx: [ 'clang++-19' ]
include:
- config: 'generic-gcc-cxx11'
cc: 'gcc-13'
cxx: 'g++-13'
cc: 'gcc-14'
cxx: 'g++-14'
- config: 'generic-cxx23'
cc: 'clang-17'
cxx: 'clang++-17'
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/pr-request-release-note.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: PR Request Release Note

permissions:
contents: read
pull-requests: write

on:
pull_request:
Expand Down Expand Up @@ -41,3 +40,10 @@ jobs:
--token "$GITHUB_TOKEN" \
request-release-note \
--pr-number ${{ github.event.pull_request.number}}
- uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0
if: always()
with:
name: workflow-args
path: |
comments
8 changes: 8 additions & 0 deletions bolt/docs/CommandLineArgumentReference.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@

Always use long jumps/nops for Linux kernel static keys

- `--match-profile-with-function-hash`

Match profile with function hash

- `--max-data-relocations=<uint>`

Maximum number of data relocations to process
Expand Down Expand Up @@ -684,6 +688,10 @@

Use a modified clustering algorithm geared towards minimizing branches

- `--name-similarity-function-matching-threshold=<uint>`

Match functions using namespace and edit distance.

- `--no-inline`

Disable all inlining (overrides other inlining options)
Expand Down
5 changes: 5 additions & 0 deletions bolt/docs/OptimizingLinux.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ $ perf2bolt -p perf.data -o perf.fdata vmlinux

Under a high load, `perf.data` should be several gigabytes in size and you should expect the converted `perf.fdata` not to exceed 100 MB.

Profiles collected from multiple workloads could be joined into a single profile using `merge-fdata` utility:
```bash
$ merge-fdata perf.1.fdata perf.2.fdata ... perf.<N>.fdata > perf.merged.fdata
```

Two changes are required for the kernel build. The first one is optional but highly recommended. It introduces a BOLT-reserved space into `vmlinux` code section:


Expand Down
9 changes: 0 additions & 9 deletions bolt/include/bolt/Core/BinaryBasicBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -842,15 +842,6 @@ class BinaryBasicBlock {
bool analyzeBranch(const MCSymbol *&TBB, const MCSymbol *&FBB,
MCInst *&CondBranch, MCInst *&UncondBranch);

/// Return true if iterator \p I is pointing to the first instruction in
/// a pair that could be macro-fused.
bool isMacroOpFusionPair(const_iterator I) const;

/// If the basic block has a pair of instructions suitable for macro-fusion,
/// return iterator to the first instruction of the pair.
/// Otherwise return end().
const_iterator getMacroOpFusionPair() const;

/// Printer required for printing dominator trees.
void printAsOperand(raw_ostream &OS, bool PrintType = true) {
if (PrintType)
Expand Down
4 changes: 0 additions & 4 deletions bolt/include/bolt/Core/BinaryContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -698,10 +698,6 @@ class BinaryContext {

/// Binary-wide aggregated stats.
struct BinaryStats {
/// Stats for macro-fusion.
uint64_t MissedMacroFusionPairs{0};
uint64_t MissedMacroFusionExecCount{0};

/// Stats for stale profile matching:
/// the total number of basic blocks in the profile
uint32_t NumStaleBlocks{0};
Expand Down
8 changes: 4 additions & 4 deletions bolt/include/bolt/Core/BinaryFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -835,10 +835,6 @@ class BinaryFunction {
/// them.
void calculateLoopInfo();

/// Calculate missed macro-fusion opportunities and update BinaryContext
/// stats.
void calculateMacroOpFusionStats();

/// Returns if BinaryDominatorTree has been constructed for this function.
bool hasDomTree() const { return BDT != nullptr; }

Expand Down Expand Up @@ -930,6 +926,10 @@ class BinaryFunction {
return const_cast<BinaryFunction *>(this)->getInstructionAtOffset(Offset);
}

/// When the function is in disassembled state, return an instruction that
/// contains the \p Offset.
MCInst *getInstructionContainingOffset(uint64_t Offset);

std::optional<MCInst> disassembleInstructionAtOffset(uint64_t Offset) const;

/// Return offset for the first instruction. If there is data at the
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===- bolt/Passes/CallGraph.h ----------------------------------*- C++ -*-===//
//===- bolt/Core/CallGraph.h ----------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand All @@ -9,7 +9,7 @@
#ifndef BOLT_PASSES_BINARY_FUNCTION_CALLGRAPH_H
#define BOLT_PASSES_BINARY_FUNCTION_CALLGRAPH_H

#include "bolt/Passes/CallGraph.h"
#include "bolt/Core/CallGraph.h"
#include <deque>
#include <functional>
#include <unordered_map>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===- bolt/Passes/CallGraph.h ----------------------------------*- C++ -*-===//
//===- bolt/Core/CallGraph.h ----------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===- bolt/Passes/CallGraphWalker.h ----------------------------*- C++ -*-===//
//===- bolt/Core/CallGraphWalker.h ----------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand Down
12 changes: 12 additions & 0 deletions bolt/include/bolt/Core/DebugData.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,15 @@ class DebugRangesSectionWriter {
static bool classof(const DebugRangesSectionWriter *Writer) {
return Writer->getKind() == RangesWriterKind::DebugRangesWriter;
}

/// Append a range to the main buffer.
void appendToRangeBuffer(const DebugBufferVector &CUBuffer);

/// Sets Unit DIE to be updated for CU.
void setDie(DIE *Die) { this->Die = Die; }

/// Returns Unit DIE to be updated for CU.
DIE *getDie() const { return Die; }

/// Writes out range lists for a current CU being processed.
void virtual finalizeSection(){};
Expand All @@ -232,6 +241,9 @@ class DebugRangesSectionWriter {
static constexpr uint64_t EmptyRangesOffset{0};

private:
/// Stores Unit DIE to be updated for CU.
DIE *Die{0};

RangesWriterKind Kind;
};

Expand Down
4 changes: 4 additions & 0 deletions bolt/include/bolt/Core/DebugNames.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ class DWARF5AcceleratorTable {
uint64_t CurrentUnitOffset = 0;
const DWARFUnit *CurrentUnit = nullptr;
std::unordered_map<uint32_t, uint32_t> AbbrevTagToIndexMap;
/// Contains a map of TU hashes to a Foreign TU indecies.
/// This is used to reduce the size of Foreign TU list since there could be
/// multiple TUs with the same hash.
DenseMap<uint64_t, uint32_t> TUHashToIndexMap;

/// Represents a group of entries with identical name (and hence, hash value).
struct HashData {
Expand Down
22 changes: 14 additions & 8 deletions bolt/include/bolt/Core/MCPlusBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,20 @@ class MCPlusBuilder {
}

/// Check whether this conditional branch can be reversed
virtual bool isReversibleBranch(const MCInst &Inst) const { return true; }
virtual bool isReversibleBranch(const MCInst &Inst) const {
assert(!isUnsupportedInstruction(Inst) && isConditionalBranch(Inst) &&
"Instruction is not known conditional branch");

if (isDynamicBranch(Inst))
return false;
return true;
}

/// Return true if this instruction inhibits analysis of the containing
/// function.
virtual bool isUnsupportedInstruction(const MCInst &Inst) const {
return false;
}

/// Return true of the instruction is of pseudo kind.
virtual bool isPseudo(const MCInst &Inst) const {
Expand Down Expand Up @@ -917,13 +930,6 @@ class MCPlusBuilder {
/// Return true if the instruction is encoded using EVEX (AVX-512).
virtual bool hasEVEXEncoding(const MCInst &Inst) const { return false; }

/// Return true if a pair of instructions represented by \p Insts
/// could be fused into a single uop.
virtual bool isMacroOpFusionPair(ArrayRef<MCInst> Insts) const {
llvm_unreachable("not implemented");
return false;
}

struct X86MemOperand {
unsigned BaseRegNum;
int64_t ScaleImm;
Expand Down
2 changes: 1 addition & 1 deletion bolt/include/bolt/Passes/HFSort.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#ifndef BOLT_PASSES_HFSORT_H
#define BOLT_PASSES_HFSORT_H

#include "bolt/Passes/CallGraph.h"
#include "bolt/Core/CallGraph.h"

#include <string>
#include <vector>
Expand Down
2 changes: 1 addition & 1 deletion bolt/include/bolt/Passes/RegReAssign.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#ifndef BOLT_PASSES_REGREASSIGN_H
#define BOLT_PASSES_REGREASSIGN_H

#include "bolt/Passes/BinaryFunctionCallGraph.h"
#include "bolt/Core/BinaryFunctionCallGraph.h"
#include "bolt/Passes/BinaryPasses.h"
#include "bolt/Passes/RegAnalysis.h"

Expand Down
2 changes: 1 addition & 1 deletion bolt/include/bolt/Passes/ReorderFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#ifndef BOLT_PASSES_REORDER_FUNCTIONS_H
#define BOLT_PASSES_REORDER_FUNCTIONS_H

#include "bolt/Passes/BinaryFunctionCallGraph.h"
#include "bolt/Core/BinaryFunctionCallGraph.h"
#include "bolt/Passes/BinaryPasses.h"

namespace llvm {
Expand Down
16 changes: 16 additions & 0 deletions bolt/include/bolt/Profile/YAMLProfileReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,29 @@ class YAMLProfileReader : public ProfileReaderBase {
bool parseFunctionProfile(BinaryFunction &Function,
const yaml::bolt::BinaryFunctionProfile &YamlBF);

/// Checks if a function profile matches a binary function.
bool profileMatches(const yaml::bolt::BinaryFunctionProfile &Profile,
const BinaryFunction &BF);

/// Infer function profile from stale data (collected on older binaries).
bool inferStaleProfile(BinaryFunction &Function,
const yaml::bolt::BinaryFunctionProfile &YamlBF);

/// Initialize maps for profile matching.
void buildNameMaps(BinaryContext &BC);

/// Matches functions using exact name.
size_t matchWithExactName();

/// Matches function using LTO comomon name.
size_t matchWithLTOCommonName();

/// Matches functions using exact hash.
size_t matchWithHash(BinaryContext &BC);

/// Matches functions with similarly named profiled functions.
size_t matchWithNameSimilarity(BinaryContext &BC);

/// Update matched YAML -> BinaryFunction pair.
void matchProfileToFunction(yaml::bolt::BinaryFunctionProfile &YamlBF,
BinaryFunction &BF) {
Expand Down
7 changes: 5 additions & 2 deletions bolt/include/bolt/Rewrite/DWARFRewriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/CodeGen/DIE.h"
#include "llvm/DWP/DWP.h"
#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCContext.h"
#include "llvm/Support/ToolOutputFile.h"
#include <cstdint>
Expand Down Expand Up @@ -90,6 +89,10 @@ class DWARFRewriter {
/// Store Rangelists writer for each DWO CU.
RangeListsDWOWriers RangeListsWritersByCU;

/// Stores ranges writer for each DWO CU.
std::unordered_map<uint64_t, std::unique_ptr<DebugRangesSectionWriter>>
LegacyRangesWritersByCU;

std::mutex LocListDebugInfoPatchesMutex;

/// Dwo id specific its RangesBase.
Expand Down Expand Up @@ -183,7 +186,7 @@ class DWARFRewriter {
void updateDebugInfo();

/// Update stmt_list for CUs based on the new .debug_line \p Layout.
void updateLineTableOffsets(const MCAsmLayout &Layout);
void updateLineTableOffsets(const MCAssembler &Asm);

uint64_t getDwoRangesBase(uint64_t DWOId) { return DwoRangesBase[DWOId]; }

Expand Down
Loading

0 comments on commit bcffdcc

Please sign in to comment.