Skip to content

Commit 7e81e63

Browse files
committed
Merge branch 'main' into fold-icmp-eq-zext-eq-self
2 parents 2285a2c + 0d7947b commit 7e81e63

File tree

1,504 files changed

+59295
-25216
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,504 files changed

+59295
-25216
lines changed

.ci/generate-buildkite-pipeline-premerge

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ set -o pipefail
2222

2323
# Environment variables script works with:
2424
# List of files affected by this commit
25-
: ${MODIFIED_FILES:=$(git diff --name-only main...HEAD)}
25+
: ${MODIFIED_FILES:=$(git diff --name-only HEAD~1)}
2626
# Filter rules for generic windows tests
2727
: ${WINDOWS_AGENTS:='{"queue": "windows"}'}
2828
# Filter rules for generic linux tests

.github/CODEOWNERS

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,32 @@
1+
# This file lists reviewers that are auto-assigned when a pull request modifies
2+
# certain files or directories. If you add yourself to this file, you commit to
3+
# reviewing a large fraction of pull requests in the relevant area.
4+
#
5+
# The GitHub "code owners" mechanism is used exclusively to auto-assign
6+
# reviewers and does not carry significance beyond that. It is not necessary
7+
# to receive an approval from a "code owner" in particular -- any LLVM project
8+
# member can approve pull requests.
9+
#
10+
# Note that GitHub's concept of "code owner" is independent from LLVM's own
11+
# "code owner" concept, they merely happen to share terminology. See
12+
# https://llvm.org/docs/DeveloperPolicy.html#code-owners, as well as the
13+
# CODE_OWNERS.txt files in the respective subproject directories.
14+
115
/libcxx/ @llvm/reviewers-libcxx
216
/libcxxabi/ @llvm/reviewers-libcxxabi
317
/libunwind/ @llvm/reviewers-libunwind
418
/runtimes/ @llvm/reviewers-libcxx
19+
20+
/llvm/lib/Analysis/BasicAliasAnalysis.cpp @nikic
21+
/llvm/lib/Analysis/InstructionSimplify.cpp @nikic
22+
/llvm/lib/Analysis/LazyValueInfo.cpp @nikic
23+
/llvm/lib/Analysis/ScalarEvolution.cpp @nikic
24+
/llvm/lib/Analysis/ValueTracking.cpp @nikic
25+
/llvm/lib/IR/ConstantRange.cpp @nikic
26+
/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp @nikic
27+
/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp @nikic
28+
/llvm/lib/Transforms/InstCombine/ @nikic
29+
30+
/clang/test/CXX/drs/ @Endilll
31+
/clang/www/cxx_dr_status.html @Endilll
32+
/clang/www/make_cxx_dr_status @Endilll

.github/workflows/llvm-tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,17 @@ jobs:
170170
uses: actions/download-artifact@v3
171171
with:
172172
name: build-baseline
173+
path: build-baseline
173174
- name: Download latest
174175
uses: actions/download-artifact@v3
175176
with:
176177
name: build-latest
178+
path: build-latest
177179
- name: Download symbol list
178180
uses: actions/download-artifact@v3
179181
with:
180182
name: symbol-list
183+
path: symbol-list
181184

182185
- name: Install abi-compliance-checker
183186
run: sudo apt-get install abi-compliance-checker

.github/workflows/release-binaries.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
matrix:
6969
target:
7070
- triple: x86_64-linux-gnu-ubuntu-22.04
71-
runs-on: ubuntu-22.04-8x32
71+
runs-on: ubuntu-22.04-16x64
7272
debian-build-deps: >
7373
chrpath
7474
gcc-multilib

bolt/include/bolt/Core/BinaryContext.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,15 @@ class BinaryContext {
871871
return nullptr;
872872
}
873873

874+
/// Retrieves a reference to ELF's _GLOBAL_OFFSET_TABLE_ symbol, which points
875+
/// at GOT, or null if it is not present in the input binary symtab.
876+
BinaryData *getGOTSymbol();
877+
878+
/// Checks if symbol name refers to ELF's _GLOBAL_OFFSET_TABLE_ symbol
879+
bool isGOTSymbol(StringRef SymName) const {
880+
return SymName == "_GLOBAL_OFFSET_TABLE_";
881+
}
882+
874883
/// Return true if \p SymbolName was generated internally and was not present
875884
/// in the input binary.
876885
bool isInternalSymbolName(const StringRef Name) {

bolt/include/bolt/Core/MCPlus.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class MCAnnotation {
6666
kTailCall, /// Tail call.
6767
kConditionalTailCall, /// CTC.
6868
kOffset, /// Offset in the function.
69+
kLabel, /// MCSymbol pointing to this instruction.
6970
kGeneric /// First generic annotation.
7071
};
7172

bolt/include/bolt/Core/MCPlusBuilder.h

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ class MCPlusBuilder {
160160
const MCInstrAnalysis *Analysis;
161161
const MCInstrInfo *Info;
162162
const MCRegisterInfo *RegInfo;
163+
const MCSubtargetInfo *STI;
163164

164165
/// Map annotation name into an annotation index.
165166
StringMap<uint64_t> AnnotationNameIndexMap;
@@ -331,8 +332,8 @@ class MCPlusBuilder {
331332

332333
public:
333334
MCPlusBuilder(const MCInstrAnalysis *Analysis, const MCInstrInfo *Info,
334-
const MCRegisterInfo *RegInfo)
335-
: Analysis(Analysis), Info(Info), RegInfo(RegInfo) {
335+
const MCRegisterInfo *RegInfo, const MCSubtargetInfo *STI)
336+
: Analysis(Analysis), Info(Info), RegInfo(RegInfo), STI(STI) {
336337
// Initialize the default annotation allocator with id 0
337338
AnnotationAllocators.emplace(0, AnnotationAllocator());
338339
MaxAllocatorId++;
@@ -1179,6 +1180,13 @@ class MCPlusBuilder {
11791180
/// Remove offset annotation.
11801181
bool clearOffset(MCInst &Inst);
11811182

1183+
/// Return the label of \p Inst, if available.
1184+
std::optional<MCSymbol *> getLabel(const MCInst &Inst) const;
1185+
1186+
/// Set the label of \p Inst. This label will be emitted right before \p Inst
1187+
/// is emitted to MCStreamer.
1188+
bool setLabel(MCInst &Inst, MCSymbol *Label);
1189+
11821190
/// Return MCSymbol that represents a target of this instruction at a given
11831191
/// operand number \p OpNum. If there's no symbol associated with
11841192
/// the operand - return nullptr.
@@ -2079,15 +2087,18 @@ class MCPlusBuilder {
20792087

20802088
MCPlusBuilder *createX86MCPlusBuilder(const MCInstrAnalysis *,
20812089
const MCInstrInfo *,
2082-
const MCRegisterInfo *);
2090+
const MCRegisterInfo *,
2091+
const MCSubtargetInfo *);
20832092

20842093
MCPlusBuilder *createAArch64MCPlusBuilder(const MCInstrAnalysis *,
20852094
const MCInstrInfo *,
2086-
const MCRegisterInfo *);
2095+
const MCRegisterInfo *,
2096+
const MCSubtargetInfo *);
20872097

20882098
MCPlusBuilder *createRISCVMCPlusBuilder(const MCInstrAnalysis *,
20892099
const MCInstrInfo *,
2090-
const MCRegisterInfo *);
2100+
const MCRegisterInfo *,
2101+
const MCSubtargetInfo *);
20912102

20922103
} // namespace bolt
20932104
} // namespace llvm

bolt/include/bolt/Core/Relocation.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ struct Relocation {
8484

8585
/// Special relocation type that allows the linker to modify the instruction.
8686
static bool isX86GOTPCRELX(uint64_t Type);
87+
static bool isX86GOTPC64(uint64_t Type);
8788

8889
/// Return true if relocation type is NONE
8990
static bool isNone(uint64_t Type);
@@ -97,6 +98,10 @@ struct Relocation {
9798
/// Return true if relocation type is for thread local storage.
9899
static bool isTLS(uint64_t Type);
99100

101+
/// Return true of relocation type is for referencing a specific instruction
102+
/// (as opposed to a function, basic block, etc).
103+
static bool isInstructionReference(uint64_t Type);
104+
100105
/// Return code for a NONE relocation
101106
static uint64_t getNone();
102107

bolt/include/bolt/Rewrite/RewriteInstance.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,8 @@ class RewriteInstance {
584584
MCPlusBuilder *createMCPlusBuilder(const Triple::ArchType Arch,
585585
const MCInstrAnalysis *Analysis,
586586
const MCInstrInfo *Info,
587-
const MCRegisterInfo *RegInfo);
587+
const MCRegisterInfo *RegInfo,
588+
const MCSubtargetInfo *STI);
588589

589590
} // namespace bolt
590591
} // namespace llvm

bolt/lib/Core/BinaryContext.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,6 +1026,31 @@ BinaryContext::getBinaryDataContainingAddressImpl(uint64_t Address) const {
10261026
return nullptr;
10271027
}
10281028

1029+
BinaryData *BinaryContext::getGOTSymbol() {
1030+
// First tries to find a global symbol with that name
1031+
BinaryData *GOTSymBD = getBinaryDataByName("_GLOBAL_OFFSET_TABLE_");
1032+
if (GOTSymBD)
1033+
return GOTSymBD;
1034+
1035+
// This symbol might be hidden from run-time link, so fetch the local
1036+
// definition if available.
1037+
GOTSymBD = getBinaryDataByName("_GLOBAL_OFFSET_TABLE_/1");
1038+
if (!GOTSymBD)
1039+
return nullptr;
1040+
1041+
// If the local symbol is not unique, fail
1042+
unsigned Index = 2;
1043+
SmallString<30> Storage;
1044+
while (const BinaryData *BD =
1045+
getBinaryDataByName(Twine("_GLOBAL_OFFSET_TABLE_/")
1046+
.concat(Twine(Index++))
1047+
.toStringRef(Storage)))
1048+
if (BD->getAddress() != GOTSymBD->getAddress())
1049+
return nullptr;
1050+
1051+
return GOTSymBD;
1052+
}
1053+
10291054
bool BinaryContext::setBinaryDataSize(uint64_t Address, uint64_t Size) {
10301055
auto NI = BinaryDataMap.find(Address);
10311056
assert(NI != BinaryDataMap.end());
@@ -1863,6 +1888,8 @@ void BinaryContext::printInstruction(raw_ostream &OS, const MCInst &Instruction,
18631888
}
18641889
if (std::optional<uint32_t> Offset = MIB->getOffset(Instruction))
18651890
OS << " # Offset: " << *Offset;
1891+
if (auto Label = MIB->getLabel(Instruction))
1892+
OS << " # Label: " << **Label;
18661893

18671894
MIB->printAnnotations(Instruction, OS);
18681895

0 commit comments

Comments
 (0)