Skip to content

Commit 26e2524

Browse files
committed
LLVM and SPIRV-LLVM-Translator pulldown (WW48)
LLVM: llvm/llvm-project@7994e51 SPIRV-LLVM-Translator: KhronosGroup/SPIRV-LLVM-Translator@b378140
2 parents e7e311e + a799e82 commit 26e2524

File tree

2,485 files changed

+104309
-34848
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,485 files changed

+104309
-34848
lines changed

bolt/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ add_subdirectory(lib)
7676
add_subdirectory(tools)
7777

7878
if (BOLT_INCLUDE_TESTS)
79-
if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include/gtest/gtest.h)
79+
if (EXISTS ${LLVM_THIRD_PARTY_DIR}/unittest/googletest/include/gtest/gtest.h)
8080
add_subdirectory(unittests)
8181
list(APPEND BOLT_TEST_DEPS BoltUnitTests)
8282
endif()

bolt/include/bolt/Core/BinaryContext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ class BinaryContext {
323323
if (FileBuildID)
324324
return StringRef(*FileBuildID);
325325

326-
return NoneType();
326+
return None;
327327
}
328328
void setFileBuildID(StringRef ID) { FileBuildID = std::string(ID); }
329329

bolt/include/bolt/Core/BinaryFunction.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ class BinaryFunction {
979979
if (Callback(StringRef(Name)))
980980
return StringRef(Name);
981981

982-
return NoneType();
982+
return None;
983983
}
984984

985985
/// Check if (possibly one out of many) function name matches the given
@@ -1317,7 +1317,7 @@ class BinaryFunction {
13171317
/// Return the name of the section this function originated from.
13181318
Optional<StringRef> getOriginSectionName() const {
13191319
if (!OriginSection)
1320-
return NoneType();
1320+
return None;
13211321
return OriginSection->getName();
13221322
}
13231323

bolt/include/bolt/Core/MCPlusBuilder.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ class MCPlusBuilder {
136136
unsigned Index) const {
137137
const MCInst *AnnotationInst = getAnnotationInst(Inst);
138138
if (!AnnotationInst)
139-
return NoneType();
139+
return None;
140140

141141
for (int I = AnnotationInst->getNumOperands() - 1; I >= 0; --I) {
142142
int64_t ImmValue = AnnotationInst->getOperand(I).getImm();
@@ -145,7 +145,7 @@ class MCPlusBuilder {
145145
}
146146
}
147147

148-
return NoneType();
148+
return None;
149149
}
150150

151151
protected:
@@ -1670,7 +1670,7 @@ class MCPlusBuilder {
16701670
auto AI = AnnotationNameIndexMap.find(Name);
16711671
if (AI != AnnotationNameIndexMap.end())
16721672
return AI->second;
1673-
return NoneType();
1673+
return None;
16741674
}
16751675

16761676
/// Return annotation index matching the \p Name. Create a new index if the

bolt/lib/Core/BinaryContext.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,8 +1191,7 @@ bool BinaryContext::handleAArch64Veneer(uint64_t Address, bool MatchOnly) {
11911191
MIB->addAnnotation(Instruction, "AArch64Veneer", true);
11921192
Veneer->addInstruction(Offset, std::move(Instruction));
11931193
--Count;
1194-
for (auto It = std::prev(Instructions.end()); Count != 0;
1195-
It = std::prev(It), --Count) {
1194+
for (auto It = Instructions.rbegin(); Count != 0; ++It, --Count) {
11961195
MIB->addAnnotation(It->second, "AArch64Veneer", true);
11971196
Veneer->addInstruction(It->first, std::move(It->second));
11981197
}
@@ -1899,7 +1898,7 @@ BinaryContext::getBaseAddressForMapping(uint64_t MMapAddress,
18991898
}
19001899
}
19011900

1902-
return NoneType();
1901+
return None;
19031902
}
19041903

19051904
ErrorOr<BinarySection &> BinaryContext::getSectionForAddress(uint64_t Address) {

bolt/lib/Core/MCPlusBuilder.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,15 @@ bool MCPlusBuilder::isTailCall(const MCInst &Inst) const {
135135

136136
Optional<MCLandingPad> MCPlusBuilder::getEHInfo(const MCInst &Inst) const {
137137
if (!isCall(Inst))
138-
return NoneType();
138+
return None;
139139
Optional<int64_t> LPSym =
140140
getAnnotationOpValue(Inst, MCAnnotation::kEHLandingPad);
141141
if (!LPSym)
142-
return NoneType();
142+
return None;
143143
Optional<int64_t> Action =
144144
getAnnotationOpValue(Inst, MCAnnotation::kEHAction);
145145
if (!Action)
146-
return NoneType();
146+
return None;
147147

148148
return std::make_pair(reinterpret_cast<const MCSymbol *>(*LPSym),
149149
static_cast<uint64_t>(*Action));
@@ -221,7 +221,7 @@ MCPlusBuilder::getConditionalTailCall(const MCInst &Inst) const {
221221
Optional<int64_t> Value =
222222
getAnnotationOpValue(Inst, MCAnnotation::kConditionalTailCall);
223223
if (!Value)
224-
return NoneType();
224+
return None;
225225
return static_cast<uint64_t>(*Value);
226226
}
227227

@@ -243,7 +243,7 @@ bool MCPlusBuilder::unsetConditionalTailCall(MCInst &Inst) {
243243
Optional<uint32_t> MCPlusBuilder::getOffset(const MCInst &Inst) const {
244244
Optional<int64_t> Value = getAnnotationOpValue(Inst, MCAnnotation::kOffset);
245245
if (!Value)
246-
return NoneType();
246+
return None;
247247
return static_cast<uint32_t>(*Value);
248248
}
249249

bolt/lib/Profile/BoltAddressTranslation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ BoltAddressTranslation::getFallthroughsInTrace(uint64_t FuncAddress,
263263

264264
auto Iter = Maps.find(FuncAddress);
265265
if (Iter == Maps.end())
266-
return NoneType();
266+
return None;
267267

268268
const MapTy &Map = Iter->second;
269269
auto FromIter = Map.upper_bound(From);

bolt/lib/Profile/DataAggregator.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ DataAggregator::getFallthroughsInTrace(BinaryFunction &BF,
943943
SmallVector<std::pair<uint64_t, uint64_t>, 16> Res;
944944

945945
if (!recordTrace(BF, FirstLBR, SecondLBR, Count, &Res))
946-
return NoneType();
946+
return None;
947947

948948
return Res;
949949
}
@@ -1820,13 +1820,13 @@ Optional<int32_t> DataAggregator::parseCommExecEvent() {
18201820
if (LineEnd == StringRef::npos) {
18211821
reportError("expected rest of line");
18221822
Diag << "Found: " << ParsingBuf << "\n";
1823-
return NoneType();
1823+
return None;
18241824
}
18251825
StringRef Line = ParsingBuf.substr(0, LineEnd);
18261826

18271827
size_t Pos = Line.find("PERF_RECORD_COMM exec");
18281828
if (Pos == StringRef::npos)
1829-
return NoneType();
1829+
return None;
18301830
Line = Line.drop_front(Pos);
18311831

18321832
// Line:
@@ -1836,7 +1836,7 @@ Optional<int32_t> DataAggregator::parseCommExecEvent() {
18361836
if (PIDStr.getAsInteger(10, PID)) {
18371837
reportError("expected PID");
18381838
Diag << "Found: " << PIDStr << "in '" << Line << "'\n";
1839-
return NoneType();
1839+
return None;
18401840
}
18411841

18421842
return PID;
@@ -1850,7 +1850,7 @@ Optional<uint64_t> parsePerfTime(const StringRef TimeStr) {
18501850
uint64_t USecTime;
18511851
if (SecTimeStr.getAsInteger(10, SecTime) ||
18521852
USecTimeStr.getAsInteger(10, USecTime))
1853-
return NoneType();
1853+
return None;
18541854
return SecTime * 1000000ULL + USecTime;
18551855
}
18561856
}
@@ -1863,14 +1863,14 @@ Optional<DataAggregator::ForkInfo> DataAggregator::parseForkEvent() {
18631863
if (LineEnd == StringRef::npos) {
18641864
reportError("expected rest of line");
18651865
Diag << "Found: " << ParsingBuf << "\n";
1866-
return NoneType();
1866+
return None;
18671867
}
18681868
StringRef Line = ParsingBuf.substr(0, LineEnd);
18691869

18701870
size_t Pos = Line.find("PERF_RECORD_FORK");
18711871
if (Pos == StringRef::npos) {
18721872
consumeRestOfLine();
1873-
return NoneType();
1873+
return None;
18741874
}
18751875

18761876
ForkInfo FI;
@@ -1889,14 +1889,14 @@ Optional<DataAggregator::ForkInfo> DataAggregator::parseForkEvent() {
18891889
if (ChildPIDStr.getAsInteger(10, FI.ChildPID)) {
18901890
reportError("expected PID");
18911891
Diag << "Found: " << ChildPIDStr << "in '" << Line << "'\n";
1892-
return NoneType();
1892+
return None;
18931893
}
18941894

18951895
const StringRef ParentPIDStr = Line.rsplit('(').second.split(':').first;
18961896
if (ParentPIDStr.getAsInteger(10, FI.ParentPID)) {
18971897
reportError("expected PID");
18981898
Diag << "Found: " << ParentPIDStr << "in '" << Line << "'\n";
1899-
return NoneType();
1899+
return None;
19001900
}
19011901

19021902
consumeRestOfLine();
@@ -2147,17 +2147,17 @@ DataAggregator::parseNameBuildIDPair() {
21472147

21482148
ErrorOr<StringRef> BuildIDStr = parseString(FieldSeparator, true);
21492149
if (std::error_code EC = BuildIDStr.getError())
2150-
return NoneType();
2150+
return None;
21512151

21522152
// If one of the strings is missing, don't issue a parsing error, but still
21532153
// do not return a value.
21542154
consumeAllRemainingFS();
21552155
if (checkNewLine())
2156-
return NoneType();
2156+
return None;
21572157

21582158
ErrorOr<StringRef> NameStr = parseString(FieldSeparator, true);
21592159
if (std::error_code EC = NameStr.getError())
2160-
return NoneType();
2160+
return None;
21612161

21622162
consumeRestOfLine();
21632163
return std::make_pair(NameStr.get(), BuildIDStr.get());
@@ -2205,7 +2205,7 @@ DataAggregator::getFileNameForBuildID(StringRef FileBuildID) {
22052205
if (!FileName.empty())
22062206
return FileName;
22072207

2208-
return NoneType();
2208+
return None;
22092209
}
22102210

22112211
std::error_code

bolt/lib/Profile/DataReader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Optional<StringRef> getLTOCommonName(const StringRef Name) {
4949
return Name.substr(0, LTOSuffixPos + 11);
5050
if ((LTOSuffixPos = Name.find(".llvm.")) != StringRef::npos)
5151
return Name.substr(0, LTOSuffixPos + 6);
52-
return NoneType();
52+
return None;
5353
}
5454

5555
namespace {

bolt/lib/Rewrite/DWARFRewriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static cl::opt<bool> KeepARanges(
9191

9292
static cl::opt<bool>
9393
DeterministicDebugInfo("deterministic-debuginfo",
94-
cl::desc("disables parallel execution of tasks that may produce"
94+
cl::desc("disables parallel execution of tasks that may produce "
9595
"nondeterministic debug info"),
9696
cl::init(true),
9797
cl::cat(BoltCategory));

bolt/lib/Rewrite/RewriteInstance.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ void RewriteInstance::parseBuildID() {
681681

682682
Optional<std::string> RewriteInstance::getPrintableBuildID() const {
683683
if (BuildID.empty())
684-
return NoneType();
684+
return None;
685685

686686
std::string Str;
687687
raw_string_ostream OS(Str);
@@ -4763,7 +4763,7 @@ void RewriteInstance::updateELFSymbolTable(
47634763
assert(SymbolName && "cannot get symbol name");
47644764

47654765
auto updateSymbolValue = [&](const StringRef Name,
4766-
Optional<uint64_t> Value = NoneType()) {
4766+
Optional<uint64_t> Value = None) {
47674767
NewSymbol.st_value = Value ? *Value : getNewValueForSymbol(Name);
47684768
NewSymbol.st_shndx = ELF::SHN_ABS;
47694769
outs() << "BOLT-INFO: setting " << Name << " to 0x"

bolt/lib/Target/X86/X86MCPlusBuilder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2600,7 +2600,7 @@ class X86MCPlusBuilder : public MCPlusBuilder {
26002600
if (FKI.Flags & MCFixupKindInfo::FKF_IsPCRel) {
26012601
switch (FKI.TargetSize) {
26022602
default:
2603-
return NoneType();
2603+
return None;
26042604
case 8: RelType = ELF::R_X86_64_PC8; break;
26052605
case 16: RelType = ELF::R_X86_64_PC16; break;
26062606
case 32: RelType = ELF::R_X86_64_PC32; break;
@@ -2609,7 +2609,7 @@ class X86MCPlusBuilder : public MCPlusBuilder {
26092609
} else {
26102610
switch (FKI.TargetSize) {
26112611
default:
2612-
return NoneType();
2612+
return None;
26132613
case 8: RelType = ELF::R_X86_64_8; break;
26142614
case 16: RelType = ELF::R_X86_64_16; break;
26152615
case 32: RelType = ELF::R_X86_64_32; break;

bolt/lib/Utils/Utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ std::string getUnescapedName(const StringRef &Name) {
6969
Optional<uint8_t> readDWARFExpressionTargetReg(StringRef ExprBytes) {
7070
uint8_t Opcode = ExprBytes[0];
7171
if (Opcode == dwarf::DW_CFA_def_cfa_expression)
72-
return NoneType();
72+
return None;
7373
assert((Opcode == dwarf::DW_CFA_expression ||
7474
Opcode == dwarf::DW_CFA_val_expression) &&
7575
"invalid DWARF expression CFI");

bolt/runtime/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ set(BOLT_RT_FLAGS
2828
-fno-rtti
2929
-fno-stack-protector
3030
-mno-sse
31-
-fPIE)
31+
-fPIC)
3232

3333
# Don't let the compiler think it can create calls to standard libs
3434
target_compile_options(bolt_rt_instr PRIVATE ${BOLT_RT_FLAGS})

bolt/test/Unit/lit.site.cfg.py.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
99
config.bolt_obj_root = "@BOLT_BINARY_DIR@"
1010
config.bolt_src_root = "@BOLT_SOURCE_DIR@"
1111
config.target_triple = "@LLVM_TARGET_TRIPLE@"
12-
config.python_executable = "@Python3_EXECUTABLE@"
1312

1413
import lit.llvm
1514
lit.llvm.initialize(lit_config, config)

bolt/test/X86/end-symbol.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# RUN: yaml2obj %p/Inputs/plt-sec.yaml &> %t.exe
22
# RUN: llvm-bolt %t.exe -o %t.out
3-
# RUN: (llvm-readelf --program-headers %t.out | tac ; llvm-nm %t.out) \
3+
# RUN: (llvm-readelf --program-headers %t.out | grep LOAD | tail -n 1 ; llvm-nm %t.out) \
44
# RUN: | FileCheck %s
55

66
## Check that llvm-bolt correctly updates _end symbol to match the end of the

bolt/test/X86/is-strip.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This test checks whether a binary is stripped or not.
22

3-
# RUN: %clang++ %p/Inputs/linenumber.cpp -o %t -Wl,-q
3+
# RUN: %clang++ %cflags %p/Inputs/linenumber.cpp -o %t -Wl,-q
44
# RUN: llvm-bolt %t -o %t.out 2>&1 | FileCheck %s -check-prefix=CHECK-NOSTRIP
55
# RUN: cp %t %t.stripped
66
# RUN: llvm-strip -s %t.stripped

bolt/test/lit.site.cfg.py.in

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,8 @@ config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
1414
config.host_triple = "@LLVM_HOST_TRIPLE@"
1515
config.target_triple = "@LLVM_TARGET_TRIPLE@"
1616
config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
17-
config.enable_shared = @ENABLE_SHARED@
18-
config.enable_backtrace = @ENABLE_BACKTRACES@
1917
config.host_arch = "@HOST_ARCH@"
20-
config.enable_abi_breaking_checks = "@LLVM_ENABLE_ABI_BREAKING_CHECKS@"
21-
config.python_executable = "@PYTHON_EXECUTABLE@"
18+
config.python_executable = "@Python3_EXECUTABLE@"
2219
config.bolt_clang = "@BOLT_CLANG_EXE@"
2320
config.bolt_lld = "@BOLT_LLD_EXE@"
2421
config.targets_to_build = "@TARGETS_TO_BUILD@"

clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ void UnusedUsingDeclsCheck::registerMatchers(MatchFinder *Finder) {
5454
Finder->addMatcher(loc(templateSpecializationType(forEachTemplateArgument(
5555
templateArgument().bind("used")))),
5656
this);
57+
Finder->addMatcher(userDefinedLiteral().bind("used"), this);
5758
// Cases where we can identify the UsingShadowDecl directly, rather than
5859
// just its target.
5960
// FIXME: cover more cases in this way, as the AST supports it.
@@ -106,9 +107,6 @@ void UnusedUsingDeclsCheck::check(const MatchFinder::MatchResult &Result) {
106107
} else if (const auto *Specialization =
107108
dyn_cast<ClassTemplateSpecializationDecl>(Used)) {
108109
removeFromFoundDecls(Specialization->getSpecializedTemplate());
109-
} else if (const auto *FD = dyn_cast<FunctionDecl>(Used)) {
110-
if (const auto *FDT = FD->getPrimaryTemplate())
111-
removeFromFoundDecls(FDT);
112110
} else if (const auto *ECD = dyn_cast<EnumConstantDecl>(Used)) {
113111
if (const auto *ET = ECD->getType()->getAs<EnumType>())
114112
removeFromFoundDecls(ET->getDecl());
@@ -150,7 +148,11 @@ void UnusedUsingDeclsCheck::check(const MatchFinder::MatchResult &Result) {
150148
if (const auto *USD = dyn_cast<UsingShadowDecl>(ND))
151149
removeFromFoundDecls(USD->getTargetDecl()->getCanonicalDecl());
152150
}
151+
return;
153152
}
153+
// Check user-defined literals
154+
if (const auto *UDL = Result.Nodes.getNodeAs<UserDefinedLiteral>("used"))
155+
removeFromFoundDecls(UDL->getCalleeDecl());
154156
}
155157

156158
void UnusedUsingDeclsCheck::removeFromFoundDecls(const Decl *D) {

0 commit comments

Comments
 (0)