Skip to content

Commit 4786174

Browse files
Merge branch 'main' into users/minglotus-6/typeprofrawformat
2 parents 744b87f + 4247175 commit 4786174

File tree

2,364 files changed

+130997
-67416
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,364 files changed

+130997
-67416
lines changed

.ci/generate-buildkite-pipeline-premerge

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,7 @@ linux_projects=$(add-dependencies ${linux_projects_to_test} | sort | uniq)
233233

234234
windows_projects_to_test=$(exclude-windows $(compute-projects-to-test ${modified_projects}))
235235
windows_check_targets=$(check-targets ${windows_projects_to_test} | sort | uniq)
236-
# Temporary disable the windows job.
237-
# See https://discourse.llvm.org/t/rfc-future-of-windows-pre-commit-ci/76840
238-
#windows_projects=$(add-dependencies ${windows_projects_to_test} | sort | uniq)
239-
windows_projects=""
236+
windows_projects=$(add-dependencies ${windows_projects_to_test} | sort | uniq)
240237

241238
# Generate the appropriate pipeline
242239
if [[ "${linux_projects}" != "" ]]; then

.ci/monolithic-windows.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ targets="${2}"
3838

3939
echo "--- cmake"
4040
pip install -q -r ${MONOREPO_ROOT}/mlir/python/requirements.txt
41+
42+
# The CMAKE_*_LINKER_FLAGS to disable the manifest come from research
43+
# on fixing a build reliability issue on the build server, please
44+
# see https://github.com/llvm/llvm-project/pull/82393 and
45+
# https://discourse.llvm.org/t/rfc-future-of-windows-pre-commit-ci/76840/40
46+
# for further information.
4147
cmake -S ${MONOREPO_ROOT}/llvm -B ${BUILD_DIR} \
4248
-D LLVM_ENABLE_PROJECTS="${projects}" \
4349
-G Ninja \
@@ -49,7 +55,10 @@ cmake -S ${MONOREPO_ROOT}/llvm -B ${BUILD_DIR} \
4955
-D COMPILER_RT_BUILD_ORC=OFF \
5056
-D CMAKE_C_COMPILER_LAUNCHER=sccache \
5157
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache \
52-
-D MLIR_ENABLE_BINDINGS_PYTHON=ON
58+
-D MLIR_ENABLE_BINDINGS_PYTHON=ON \
59+
-D CMAKE_EXE_LINKER_FLAGS="/MANIFEST:NO" \
60+
-D CMAKE_MODULE_LINKER_FLAGS="/MANIFEST:NO" \
61+
-D CMAKE_SHARED_LINKER_FLAGS="/MANIFEST:NO"
5362

5463
echo "--- ninja"
5564
# Targets are not escaped as they are passed as separate arguments.

.github/new-prs-labeler.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,30 @@ backend:X86:
822822
- llvm/lib/TargetParser/X86*
823823
- llvm/utils/TableGen/X86*
824824

825+
backend:PowerPC:
826+
- llvm/include/llvm/BinaryFormat/ELFRelocs/PowerPC*
827+
- llvm/include/llvm/BinaryFormat/XCOFF.h
828+
- llvm/include/llvm/IR/IntrinsicsPowerPC.td
829+
- llvm/lib/CodeGen/AsmPrinter/AIXException.cpp
830+
- llvm/lib/Target/PowerPC/**
831+
- llvm/test/Analysis/**/PowerPC/**
832+
- llvm/test/CodeGen/PowerPC/**
833+
- llvm/test/CodeGen/MIR/PowerPC/**
834+
- llvm/test/DebugInfo/XCOFF/**
835+
- llvm/test/DebugInfo/PowerPC/**
836+
- llvm/test/LTO/PowerPC/**
837+
- llvm/test/MC/Disassembler/PowerPC/**
838+
- llvm/test/MC/PowerPC/**
839+
- llvm/test/MC/XCOFF/**
840+
- llvm/test/Transforms/**/PowerPC/**
841+
- clang/include/clang/Basic/BuiltinsPPC.*
842+
- clang/lib/Basic/Targets/PPC.*
843+
- clang/lib/CodeGen/Targets/PPC.cpp
844+
- clang/lib/Driver/ToolChains/PPC*
845+
- clang/lib/Driver/ToolChains/AIX*
846+
- clang/lib/Driver/ToolChains/Arch/PPC.*
847+
- clang/test/CodeGen/PowerPC/**
848+
825849
third-party:unittests:
826850
- third-party/unittests/**
827851

.github/workflows/approved-prs.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

.github/workflows/docs.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ on:
2828
- 'polly/docs/**'
2929
- 'flang/docs/**'
3030
- 'flang/include/flang/Optimizer/Dialect/FIROps.td'
31+
- '.github/workflows/docs.yml'
3132
pull_request:
3233
paths:
3334
- 'llvm/docs/**'
@@ -45,6 +46,7 @@ on:
4546
- 'polly/docs/**'
4647
- 'flang/docs/**'
4748
- 'flang/include/flang/Optimizer/Dialect/FIROps.td'
49+
- '.github/workflows/docs.yml'
4850

4951
jobs:
5052
check-docs-build:
@@ -162,8 +164,6 @@ jobs:
162164
TZ=UTC ninja -C polly-build docs-polly-html docs-polly-man
163165
- name: Build Flang docs
164166
if: steps.docs-changed-subprojects.outputs.flang_any_changed == 'true'
165-
# TODO(boomanaiden154): Remove the SPHINX_WARNINGS_AS_ERRORS from the
166-
# CMake invocation once the warnings in the flang docs build are fixed.
167167
run: |
168-
cmake -B flang-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;mlir;flang" -DLLVM_ENABLE_SPHINX=ON -DSPHINX_WARNINGS_AS_ERRORS=OFF ./llvm
169-
TZ=UTC ninja -C flang-build docs-flang-html docs-flang-man
168+
cmake -B flang-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;mlir;flang" -DLLVM_ENABLE_SPHINX=ON ./llvm
169+
TZ=UTC ninja -C flang-build docs-flang-html

.github/workflows/llvm-project-tests.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ jobs:
5858
lit-tests:
5959
name: Lit Tests
6060
runs-on: ${{ matrix.os }}
61+
container:
62+
image: ${{(startsWith(matrix.os, 'ubuntu') && 'ghcr.io/llvm/ci-ubuntu-22.04:latest') || null}}
63+
volumes:
64+
- /mnt/:/mnt/
6165
strategy:
6266
fail-fast: false
6367
matrix:
@@ -77,6 +81,7 @@ jobs:
7781
with:
7882
python-version: ${{ inputs.python_version }}
7983
- name: Install Ninja
84+
if: runner.os != 'Linux'
8085
uses: llvm/actions/install-ninja@main
8186
# actions/checkout deletes any existing files in the new git directory,
8287
# so this needs to either run before ccache-action or it has to use
@@ -108,8 +113,8 @@ jobs:
108113
run: |
109114
if [ "${{ runner.os }}" == "Linux" ]; then
110115
builddir="/mnt/build/"
111-
sudo mkdir -p $builddir
112-
sudo chown `whoami`:`whoami` $builddir
116+
mkdir -p $builddir
117+
extra_cmake_args="-DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang"
113118
else
114119
builddir="$(pwd)"/build
115120
fi
@@ -123,6 +128,7 @@ jobs:
123128
-DLLDB_INCLUDE_TESTS=OFF \
124129
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
125130
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
131+
$extra_cmake_args \
126132
${{ inputs.extra_cmake_args }}
127133
ninja -C "$builddir" '${{ inputs.build_target }}'
128134

.github/workflows/release-tasks.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
name: Create a New Release
2929
runs-on: ubuntu-latest
3030
needs: validate-tag
31+
3132
steps:
3233
- name: Install Dependencies
3334
run: |
@@ -40,8 +41,9 @@ jobs:
4041
- name: Create Release
4142
env:
4243
GITHUB_TOKEN: ${{ github.token }}
44+
USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }}
4345
run: |
44-
./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --release ${{ needs.validate-tag.outputs.release-version }} --user ${{ github.actor }} create
46+
./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --release ${{ needs.validate-tag.outputs.release-version }} --user ${{ github.actor }} --user-token "$USER_TOKEN" create
4547
release-documentation:
4648
name: Build and Upload Release Documentation
4749
needs:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ files needed to process intermediate representations and convert them into
1616
object files. Tools include an assembler, disassembler, bitcode analyzer, and
1717
bitcode optimizer.
1818

19-
C-like languages use the [Clang](http://clang.llvm.org/) frontend. This
19+
C-like languages use the [Clang](https://clang.llvm.org/) frontend. This
2020
component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode
2121
-- and from there into object files, using LLVM.
2222

bolt/include/bolt/Profile/BoltAddressTranslation.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <map>
1717
#include <optional>
1818
#include <system_error>
19+
#include <unordered_map>
1920

2021
namespace llvm {
2122
class raw_ostream;
@@ -111,6 +112,9 @@ class BoltAddressTranslation {
111112
/// addresses when aggregating profile
112113
bool enabledFor(llvm::object::ELFObjectFileBase *InputFile) const;
113114

115+
/// Save function and basic block hashes used for metadata dump.
116+
void saveMetadata(BinaryContext &BC);
117+
114118
private:
115119
/// Helper to update \p Map by inserting one or more BAT entries reflecting
116120
/// \p BB for function located at \p FuncAddress. At least one entry will be
@@ -140,6 +144,9 @@ class BoltAddressTranslation {
140144

141145
std::map<uint64_t, MapTy> Maps;
142146

147+
using BBHashMap = std::unordered_map<uint32_t, size_t>;
148+
std::unordered_map<uint64_t, std::pair<size_t, BBHashMap>> FuncHashes;
149+
143150
/// Links outlined cold bocks to their original function
144151
std::map<uint64_t, uint64_t> ColdPartSource;
145152

bolt/lib/Core/DebugData.cpp

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ template <typename DebugVector, typename ListEntry, typename DebugAddressEntry>
230230
static bool emitWithBase(raw_ostream &OS, const DebugVector &Entries,
231231
DebugAddrWriter &AddrWriter, DWARFUnit &CU,
232232
uint32_t &Index, const ListEntry BaseAddressx,
233-
const ListEntry OffsetPair, const ListEntry EndOfList,
233+
const ListEntry OffsetPair,
234234
const std::function<void(uint32_t)> &Func) {
235235
if (Entries.size() < 2)
236236
return false;
@@ -241,7 +241,9 @@ static bool emitWithBase(raw_ostream &OS, const DebugVector &Entries,
241241
const DebugAddressEntry &Entry = Entries[Index];
242242
if (Entry.LowPC == 0)
243243
break;
244-
assert(Base <= Entry.LowPC && "Entry base is higher than low PC");
244+
// In case rnglists or loclists are not sorted.
245+
if (Base > Entry.LowPC)
246+
break;
245247
uint32_t StartOffset = Entry.LowPC - Base;
246248
uint32_t EndOffset = Entry.HighPC - Base;
247249
if (encodeULEB128(EndOffset, TempBuffer) > 2)
@@ -266,8 +268,6 @@ static bool emitWithBase(raw_ostream &OS, const DebugVector &Entries,
266268
encodeULEB128(OffsetEntry.EndOffset, OS);
267269
Func(OffsetEntry.Index);
268270
}
269-
support::endian::write(OS, static_cast<uint8_t>(EndOfList),
270-
llvm::endianness::little);
271271
return true;
272272
}
273273

@@ -276,19 +276,17 @@ DebugRangeListsSectionWriter::addRanges(DebugAddressRangesVector &Ranges) {
276276
std::lock_guard<std::mutex> Lock(WriterMutex);
277277

278278
RangeEntries.push_back(CurrentOffset);
279-
bool WrittenStartxLength = false;
280279
std::sort(
281280
Ranges.begin(), Ranges.end(),
282281
[](const DebugAddressRange &R1, const DebugAddressRange &R2) -> bool {
283282
return R1.LowPC < R2.LowPC;
284283
});
285284
for (unsigned I = 0; I < Ranges.size();) {
286-
WrittenStartxLength = false;
287285
if (emitWithBase<DebugAddressRangesVector, dwarf::RnglistEntries,
288-
DebugAddressRange>(
289-
*CUBodyStream, Ranges, *AddrWriter, *CU, I,
290-
dwarf::DW_RLE_base_addressx, dwarf::DW_RLE_offset_pair,
291-
dwarf::DW_RLE_end_of_list, [](uint32_t Index) -> void {}))
286+
DebugAddressRange>(*CUBodyStream, Ranges, *AddrWriter, *CU,
287+
I, dwarf::DW_RLE_base_addressx,
288+
dwarf::DW_RLE_offset_pair,
289+
[](uint32_t Index) -> void {}))
292290
continue;
293291

294292
const DebugAddressRange &Range = Ranges[I];
@@ -299,12 +297,11 @@ DebugRangeListsSectionWriter::addRanges(DebugAddressRangesVector &Ranges) {
299297
encodeULEB128(Index, *CUBodyStream);
300298
encodeULEB128(Range.HighPC - Range.LowPC, *CUBodyStream);
301299
++I;
302-
WrittenStartxLength = true;
303300
}
304-
if (WrittenStartxLength)
305-
support::endian::write(*CUBodyStream,
306-
static_cast<uint8_t>(dwarf::DW_RLE_end_of_list),
307-
llvm::endianness::little);
301+
302+
support::endian::write(*CUBodyStream,
303+
static_cast<uint8_t>(dwarf::DW_RLE_end_of_list),
304+
llvm::endianness::little);
308305
CurrentOffset = CUBodyBuffer->size();
309306
return RangeEntries.size() - 1;
310307
}
@@ -688,20 +685,18 @@ static void writeDWARF5LocList(uint32_t &NumberOfEntries, DIEValue &AttrInfo,
688685
}
689686

690687
std::vector<uint64_t> OffsetsArray;
691-
bool WrittenStartxLength = false;
692688
auto writeExpression = [&](uint32_t Index) -> void {
693689
const DebugLocationEntry &Entry = LocList[Index];
694690
encodeULEB128(Entry.Expr.size(), LocBodyStream);
695691
LocBodyStream << StringRef(
696692
reinterpret_cast<const char *>(Entry.Expr.data()), Entry.Expr.size());
697693
};
698694
for (unsigned I = 0; I < LocList.size();) {
699-
WrittenStartxLength = false;
700695
if (emitWithBase<DebugLocationsVector, dwarf::LoclistEntries,
701-
DebugLocationEntry>(
702-
LocBodyStream, LocList, AddrWriter, CU, I,
703-
dwarf::DW_LLE_base_addressx, dwarf::DW_LLE_offset_pair,
704-
dwarf::DW_LLE_end_of_list, writeExpression))
696+
DebugLocationEntry>(LocBodyStream, LocList, AddrWriter, CU,
697+
I, dwarf::DW_LLE_base_addressx,
698+
dwarf::DW_LLE_offset_pair,
699+
writeExpression))
705700
continue;
706701

707702
const DebugLocationEntry &Entry = LocList[I];
@@ -713,13 +708,11 @@ static void writeDWARF5LocList(uint32_t &NumberOfEntries, DIEValue &AttrInfo,
713708
encodeULEB128(Entry.HighPC - Entry.LowPC, LocBodyStream);
714709
writeExpression(I);
715710
++I;
716-
WrittenStartxLength = true;
717711
}
718712

719-
if (WrittenStartxLength)
720-
support::endian::write(LocBodyStream,
721-
static_cast<uint8_t>(dwarf::DW_LLE_end_of_list),
722-
llvm::endianness::little);
713+
support::endian::write(LocBodyStream,
714+
static_cast<uint8_t>(dwarf::DW_LLE_end_of_list),
715+
llvm::endianness::little);
723716
}
724717

725718
void DebugLoclistWriter::addList(DIEBuilder &DIEBldr, DIE &Die,

bolt/lib/Profile/BoltAddressTranslation.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,5 +424,20 @@ bool BoltAddressTranslation::enabledFor(
424424
}
425425
return false;
426426
}
427+
428+
void BoltAddressTranslation::saveMetadata(BinaryContext &BC) {
429+
for (BinaryFunction &BF : llvm::make_second_range(BC.getBinaryFunctions())) {
430+
// We don't need a translation table if the body of the function hasn't
431+
// changed
432+
if (BF.isIgnored() || (!BC.HasRelocations && !BF.isSimple()))
433+
continue;
434+
// Prepare function and block hashes
435+
FuncHashes[BF.getAddress()].first = BF.computeHash();
436+
BF.computeBlockHashes();
437+
for (const BinaryBasicBlock &BB : BF)
438+
FuncHashes[BF.getAddress()].second.emplace(BB.getInputOffset(),
439+
BB.getHash());
440+
}
441+
}
427442
} // namespace bolt
428443
} // namespace llvm

0 commit comments

Comments
 (0)