Skip to content

Commit

Permalink
LLVM and SPIRV-LLVM-Translator pulldown (WW32)
Browse files Browse the repository at this point in the history
  • Loading branch information
nstester committed Aug 16, 2023
2 parents 1ad69e5 + a26b643 commit 8e92193
Show file tree
Hide file tree
Showing 15,114 changed files with 1,057,684 additions and 436,477 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
53 changes: 53 additions & 0 deletions .ci/generate-buildkite-pipeline-premerge
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env bash
#===----------------------------------------------------------------------===##
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===----------------------------------------------------------------------===##

#
# This file generates a Buildkite pipeline that triggers the various CI jobs for
# the LLVM project during pre-commit CI (each time a Phabricator diff is uploaded).
#
# See https://buildkite.com/docs/agent/v3/cli-pipeline#pipeline-format.
#

if ! git diff --name-only HEAD~1 | grep -q -E "^libcxx/|^libcxxabi/|^libunwind/|^runtimes/|^cmake/|^clang/"; then
# libcxx/, libcxxabi/, libunwind/, runtimes/, cmake/ or clang/ are not affected
exit 0
fi

reviewID="$(git log --format=%B -n 1 | sed -nE 's/^Review-ID:[[:space:]]*(.+)$/\1/p')"
if [[ "${reviewID}" != "" ]]; then
buildMessage="https://llvm.org/${reviewID}"
else
buildMessage="Push to branch ${BUILDKITE_BRANCH}"
fi

cat <<EOF
steps:
EOF

# If libc++ or one of the runtimes directories changed
if git diff --name-only HEAD~1 | grep -q -E "^libcxx/|^libcxxabi/|^libunwind/|^runtimes/|^cmake/"; then
cat <<EOF
- trigger: "libcxx-ci"
build:
message: "${buildMessage}"
commit: "${BUILDKITE_COMMIT}"
branch: "${BUILDKITE_BRANCH}"
EOF
fi

# If clang changed
if git diff --name-only HEAD~1 | grep -q -E "^clang/"; then
cat <<EOF
- trigger: "clang-ci"
build:
message: "${buildMessage}"
commit: "${BUILDKITE_COMMIT}"
branch: "${BUILDKITE_BRANCH}"
EOF
fi
30 changes: 30 additions & 0 deletions .ci/generate-buildkite-pipeline-scheduled
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
#===----------------------------------------------------------------------===##
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===----------------------------------------------------------------------===##

#
# This file generates a Buildkite pipeline that triggers the various CI jobs for
# the LLVM project on scheduled builds.
#
# See https://buildkite.com/docs/agent/v3/cli-pipeline#pipeline-format.
#

cat <<EOF
steps:
- trigger: "libcxx-ci"
build:
message: "${BUILDKITE_MESSAGE}"
commit: "${BUILDKITE_COMMIT}"
branch: "${BUILDKITE_BRANCH}"
- trigger: "clang-ci"
build:
message: "${BUILDKITE_MESSAGE}"
commit: "${BUILDKITE_COMMIT}"
branch: "${BUILDKITE_BRANCH}"
EOF
6 changes: 6 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,9 @@ f9008e6366c2496b1ca1785b891d5578174ad63e

# [libc++][NFC] Apply clang-format on large parts of the code base
5aa03b648b827128d439f705cd7d57d59673741d

# [clang][NFC] Remove trailing whitespaces and enforce it in lib, include and docs
f6d557ee34b6bbdb1dc32f29e34b4a4a8ad35e81

# [libc++][NFC] clang-format <shared_mutex>
2d7eb9c9ea1a146412a83603d5c0c6339a5d8284
5 changes: 3 additions & 2 deletions .github/workflows/closed-issues.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Labeling closed issues
on:
issues:
types: ['closed']
workflow_dispatch
# issues:
# types: ['closed']

permissions:
contents: read
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
uses: actions/checkout@v3

- name: Install dependencies
run: apt-get install -y python3-setuptools
run: sudo apt-get install -y python3-setuptools

- name: Test lit
run: |
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/repo-lockdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ on:
- 'libcxxabi/**'
- 'libunwind/**'
- 'runtimes/**'
- 'lldb/**'
- '.github/**'
- 'clang/lib/Format/**'
- 'clang/include/clang/Format/**'
- 'clang/docs/**'
- 'clang/unitests/Format/**'
- 'clang/tools/clang-format/**'

permissions:
pull-requests: write
Expand Down
2 changes: 1 addition & 1 deletion bolt/include/bolt/Core/BinaryBasicBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class BinaryBasicBlock {
/// After output/codegen, map output offsets of instructions in this basic
/// block to instruction offsets in the original function. Note that the
/// output basic block could be different from the input basic block.
/// We only map instruction of interest, such as calls, and sdt markers.
/// We only map instruction of interest, such as calls and markers.
///
/// We store the offset array in a basic block to facilitate BAT tables
/// generation. Otherwise, the mapping could be done at function level.
Expand Down
30 changes: 16 additions & 14 deletions bolt/include/bolt/Core/BinaryContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCObjectFileInfo.h"
#include "llvm/MC/MCObjectWriter.h"
#include "llvm/MC/MCPseudoProbe.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCSectionMachO.h"
#include "llvm/MC/MCStreamer.h"
Expand Down Expand Up @@ -639,9 +638,22 @@ class BinaryContext {
/// Total hotness score according to profiling data for this binary.
uint64_t TotalScore{0};

/// Binary-wide stats for macro-fusion.
uint64_t MissedMacroFusionPairs{0};
uint64_t MissedMacroFusionExecCount{0};
/// 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};
/// the number of matched basic blocks
uint32_t NumMatchedBlocks{0};
/// the total count of samples in the profile
uint64_t StaleSampleCount{0};
/// the count of matched samples
uint64_t MatchedSampleCount{0};
} Stats;

// Address of the first allocated segment.
uint64_t FirstAllocAddress{std::numeric_limits<uint64_t>::max()};
Expand Down Expand Up @@ -673,20 +685,10 @@ class BinaryContext {
/// List of functions that always trap.
std::vector<const BinaryFunction *> TrappedFunctions;

/// Map SDT locations to SDT markers info
std::unordered_map<uint64_t, SDTMarkerInfo> SDTMarkers;

/// Map linux kernel program locations/instructions to their pointers in
/// special linux kernel sections
std::unordered_map<uint64_t, std::vector<LKInstructionMarkerInfo>> LKMarkers;

/// List of external addresses in the code that are not a function start
/// and are referenced from BinaryFunction.
std::list<std::pair<BinaryFunction *, uint64_t>> InterproceduralReferences;

/// PseudoProbe decoder
MCPseudoProbeDecoder ProbeDecoder;

/// DWARF encoding. Available encoding types defined in BinaryFormat/Dwarf.h
/// enum Constants, e.g. DW_EH_PE_omit.
unsigned LSDAEncoding = dwarf::DW_EH_PE_omit;
Expand Down
51 changes: 31 additions & 20 deletions bolt/include/bolt/Core/BinaryFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,9 @@ class BinaryFunction {
bool HasPseudoProbe{BC.getUniqueSectionByName(".pseudo_probe_desc") &&
BC.getUniqueSectionByName(".pseudo_probe")};

/// True if the function uses ORC format for stack unwinding.
bool HasORC{false};

/// True if the original entry point was patched.
bool IsPatched{false};

Expand Down Expand Up @@ -378,7 +381,7 @@ class BinaryFunction {
/// Profile match ratio.
float ProfileMatchRatio{0.0f};

/// Raw branch count for this function in the profile
/// Raw branch count for this function in the profile.
uint64_t RawBranchCount{0};

/// Indicates the type of profile the function is using.
Expand Down Expand Up @@ -423,21 +426,6 @@ class BinaryFunction {
return BB->getIndex();
}

/// Return basic block that originally contained offset \p Offset
/// from the function start.
BinaryBasicBlock *getBasicBlockContainingOffset(uint64_t Offset);

const BinaryBasicBlock *getBasicBlockContainingOffset(uint64_t Offset) const {
return const_cast<BinaryFunction *>(this)->getBasicBlockContainingOffset(
Offset);
}

/// Return basic block that started at offset \p Offset.
BinaryBasicBlock *getBasicBlockAtOffset(uint64_t Offset) {
BinaryBasicBlock *BB = getBasicBlockContainingOffset(Offset);
return BB && BB->getOffset() == Offset ? BB : nullptr;
}

/// Release memory taken by the list.
template <typename T> BinaryFunction &clearList(T &List) {
T TempList;
Expand Down Expand Up @@ -619,10 +607,6 @@ class BinaryFunction {
Islands->CodeOffsets.emplace(Offset);
}

/// Register secondary entry point at a given \p Offset into the function.
/// Return global symbol for use by extern function references.
MCSymbol *addEntryPointAtOffset(uint64_t Offset);

/// Register an internal offset in a function referenced from outside.
void registerReferencedOffset(uint64_t Offset) {
ExternallyReferencedOffsets.emplace(Offset);
Expand Down Expand Up @@ -900,6 +884,21 @@ class BinaryFunction {
return LabelToBB.lookup(Label);
}

/// Return basic block that originally contained offset \p Offset
/// from the function start.
BinaryBasicBlock *getBasicBlockContainingOffset(uint64_t Offset);

const BinaryBasicBlock *getBasicBlockContainingOffset(uint64_t Offset) const {
return const_cast<BinaryFunction *>(this)->getBasicBlockContainingOffset(
Offset);
}

/// Return basic block that started at offset \p Offset.
BinaryBasicBlock *getBasicBlockAtOffset(uint64_t Offset) {
BinaryBasicBlock *BB = getBasicBlockContainingOffset(Offset);
return BB && BB->getOffset() == Offset ? BB : nullptr;
}

/// Retrieve the landing pad BB associated with invoke instruction \p Invoke
/// that is in \p BB. Return nullptr if none exists
BinaryBasicBlock *getLandingPadBBFor(const BinaryBasicBlock &BB,
Expand Down Expand Up @@ -1344,6 +1343,9 @@ class BinaryFunction {
/// Return true if the function has Pseudo Probe
bool hasPseudoProbe() const { return HasPseudoProbe; }

/// Return true if the function uses ORC format for stack unwinding.
bool hasORC() const { return HasORC; }

/// Return true if the original entry point was patched.
bool isPatched() const { return IsPatched; }

Expand Down Expand Up @@ -1445,6 +1447,10 @@ class BinaryFunction {
/// symbol associated with the entry.
MCSymbol *addEntryPoint(const BinaryBasicBlock &BB);

/// Register secondary entry point at a given \p Offset into the function.
/// Return global symbol for use by extern function references.
MCSymbol *addEntryPointAtOffset(uint64_t Offset);

/// Mark all blocks that are unreachable from a root (entry point
/// or landing pad) as invalid.
void markUnreachableBlocks();
Expand Down Expand Up @@ -1702,6 +1708,11 @@ class BinaryFunction {
/// Indicate that another function body was merged with this function.
void setHasFunctionsFoldedInto() { HasFunctionsFoldedInto = true; }

void setHasSDTMarker(bool V) { HasSDTMarker = V; }

/// Mark the function as using ORC format for stack unwinding.
void setHasORC(bool V) { HasORC = V; }

BinaryFunction &setPersonalityFunction(uint64_t Addr) {
assert(!PersonalityFunction && "can't set personality function twice");
PersonalityFunction = BC.getOrCreateGlobalSymbol(Addr, "FUNCat");
Expand Down
21 changes: 0 additions & 21 deletions bolt/include/bolt/Core/BinarySection.h
Original file line number Diff line number Diff line change
Expand Up @@ -509,27 +509,6 @@ inline raw_ostream &operator<<(raw_ostream &OS, const BinarySection &Section) {
return OS;
}

struct SDTMarkerInfo {
uint64_t PC;
uint64_t Base;
uint64_t Semaphore;
StringRef Provider;
StringRef Name;
StringRef Args;

/// The offset of PC within the note section
unsigned PCOffset;
};

/// Linux Kernel special sections point to a specific instruction in many cases.
/// Unlike SDTMarkerInfo, these markers can come from different sections.
struct LKInstructionMarkerInfo {
uint64_t SectionOffset;
int32_t PCRelativeOffset;
bool IsPCRelative;
StringRef SectionName;
};

} // namespace bolt
} // namespace llvm

Expand Down
Loading

0 comments on commit 8e92193

Please sign in to comment.