Skip to content

Commit 43c1b1b

Browse files
AutomergerAutomerger
Automerger
authored and
Automerger
committed
Propagating prior merge from 'llvm.org/master'.
apple-llvm-split-commit: 9bd6d4d3bfd3b5303f970a1da97420d16a3250bb apple-llvm-split-dir: llvm/
2 parents cc7df87 + c38e3ef commit 43c1b1b

File tree

203 files changed

+6801
-2545
lines changed

Some content is hidden

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

203 files changed

+6801
-2545
lines changed
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
# REQUIRES: x86
2-
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
3-
# RUN: rm -f %/terr1.script
4-
# RUN: echo "\"" > %/terr1.script
5-
# RUN: not ld.lld --vs-diagnostics --version-script %/terr1.script -shared %/t.o -o %/t.so 2>&1 | \
1+
# RUN: echo "\"" > %/terr1.script
2+
# RUN: not ld.lld --vs-diagnostics --version-script %/terr1.script 2>&1 | \
63
# RUN: FileCheck %s -DSCRIPT="%/terr1.script"
74

85
# CHECK: [[SCRIPT]](1): error: [[SCRIPT]]:1: unclosed quote

llvm/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ set(LLVM_ALL_TARGETS
285285
MSP430
286286
NVPTX
287287
PowerPC
288+
RISCV
288289
Sparc
289290
SystemZ
290291
WebAssembly

llvm/docs/ProgrammersManual.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@ T value:
821821

822822
Like the ExitOnError utility, cantFail simplifies control flow. Their treatment
823823
of error cases is very different however: Where ExitOnError is guaranteed to
824-
terminate the program on an error input, cantFile simply asserts that the result
824+
terminate the program on an error input, cantFail simply asserts that the result
825825
is success. In debug builds this will result in an assertion failure if an error
826826
is encountered. In release builds the behavior of cantFail for failure values is
827827
undefined. As such, care must be taken in the use of cantFail: clients must be

llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,28 +64,30 @@ class KaleidoscopeJIT {
6464
public:
6565
KaleidoscopeJIT()
6666
: TM(EngineBuilder().selectTarget()), DL(TM->createDataLayout()),
67-
ObjectLayer(ES,
67+
ObjectLayer(AcknowledgeORCv1Deprecation, ES,
6868
[this](VModuleKey K) {
6969
return LegacyRTDyldObjectLinkingLayer::Resources{
7070
std::make_shared<SectionMemoryManager>(),
7171
Resolvers[K]};
7272
}),
73-
CompileLayer(ObjectLayer, SimpleCompiler(*TM)),
74-
OptimizeLayer(CompileLayer,
73+
CompileLayer(AcknowledgeORCv1Deprecation, ObjectLayer,
74+
SimpleCompiler(*TM)),
75+
OptimizeLayer(AcknowledgeORCv1Deprecation, CompileLayer,
7576
[this](std::unique_ptr<Module> M) {
7677
return optimizeModule(std::move(M));
7778
}),
7879
CompileCallbackManager(cantFail(orc::createLocalCompileCallbackManager(
7980
TM->getTargetTriple(), ES, 0))),
80-
CODLayer(ES, OptimizeLayer,
81-
[&](orc::VModuleKey K) { return Resolvers[K]; },
82-
[&](orc::VModuleKey K, std::shared_ptr<SymbolResolver> R) {
83-
Resolvers[K] = std::move(R);
84-
},
85-
[](Function &F) { return std::set<Function *>({&F}); },
86-
*CompileCallbackManager,
87-
orc::createLocalIndirectStubsManagerBuilder(
88-
TM->getTargetTriple())) {
81+
CODLayer(
82+
AcknowledgeORCv1Deprecation, ES, OptimizeLayer,
83+
[&](orc::VModuleKey K) { return Resolvers[K]; },
84+
[&](orc::VModuleKey K, std::shared_ptr<SymbolResolver> R) {
85+
Resolvers[K] = std::move(R);
86+
},
87+
[](Function &F) { return std::set<Function *>({&F}); },
88+
*CompileCallbackManager,
89+
orc::createLocalIndirectStubsManagerBuilder(
90+
TM->getTargetTriple())) {
8991
llvm::sys::DynamicLibrary::LoadLibraryPermanently(nullptr);
9092
}
9193

llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,14 @@ class KaleidoscopeJIT {
105105
},
106106
[](Error Err) { cantFail(std::move(Err), "lookupFlags failed"); })),
107107
TM(EngineBuilder().selectTarget()), DL(TM->createDataLayout()),
108-
ObjectLayer(ES,
108+
ObjectLayer(AcknowledgeORCv1Deprecation, ES,
109109
[this](VModuleKey K) {
110110
return LegacyRTDyldObjectLinkingLayer::Resources{
111111
std::make_shared<SectionMemoryManager>(), Resolver};
112112
}),
113-
CompileLayer(ObjectLayer, SimpleCompiler(*TM)),
114-
OptimizeLayer(CompileLayer,
113+
CompileLayer(AcknowledgeORCv1Deprecation, ObjectLayer,
114+
SimpleCompiler(*TM)),
115+
OptimizeLayer(AcknowledgeORCv1Deprecation, CompileLayer,
115116
[this](std::unique_ptr<Module> M) {
116117
return optimizeModule(std::move(M));
117118
}),

llvm/examples/Kaleidoscope/BuildingAJIT/Chapter5/KaleidoscopeJIT.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,15 @@ class KaleidoscopeJIT {
113113
TM(EngineBuilder().selectTarget(Triple(Remote.getTargetTriple()), "",
114114
"", SmallVector<std::string, 0>())),
115115
DL(TM->createDataLayout()),
116-
ObjectLayer(ES,
116+
ObjectLayer(AcknowledgeORCv1Deprecation, ES,
117117
[this](VModuleKey K) {
118118
return LegacyRTDyldObjectLinkingLayer::Resources{
119119
cantFail(this->Remote.createRemoteMemoryManager()),
120120
Resolver};
121121
}),
122-
CompileLayer(ObjectLayer, SimpleCompiler(*TM)),
123-
OptimizeLayer(CompileLayer,
122+
CompileLayer(AcknowledgeORCv1Deprecation, ObjectLayer,
123+
SimpleCompiler(*TM)),
124+
OptimizeLayer(AcknowledgeORCv1Deprecation, CompileLayer,
124125
[this](std::unique_ptr<Module> M) {
125126
return optimizeModule(std::move(M));
126127
}),

llvm/examples/Kaleidoscope/include/KaleidoscopeJIT.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,16 @@ class KaleidoscopeJIT {
4545
KaleidoscopeJIT()
4646
: Resolver(createLegacyLookupResolver(
4747
ES,
48-
[this](const std::string &Name) {
49-
return findMangledSymbol(Name);
50-
},
48+
[this](const std::string &Name) { return findMangledSymbol(Name); },
5149
[](Error Err) { cantFail(std::move(Err), "lookupFlags failed"); })),
5250
TM(EngineBuilder().selectTarget()), DL(TM->createDataLayout()),
53-
ObjectLayer(ES,
51+
ObjectLayer(AcknowledgeORCv1Deprecation, ES,
5452
[this](VModuleKey) {
5553
return ObjLayerT::Resources{
5654
std::make_shared<SectionMemoryManager>(), Resolver};
5755
}),
58-
CompileLayer(ObjectLayer, SimpleCompiler(*TM)) {
56+
CompileLayer(AcknowledgeORCv1Deprecation, ObjectLayer,
57+
SimpleCompiler(*TM)) {
5958
llvm::sys::DynamicLibrary::LoadLibraryPermanently(nullptr);
6059
}
6160

llvm/include/llvm/Analysis/TargetTransformInfo.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,18 @@ class TargetTransformInfo {
263263
/// individual classes of instructions would be better.
264264
unsigned getInliningThresholdMultiplier() const;
265265

266+
/// \returns Vector bonus in percent.
267+
///
268+
/// Vector bonuses: We want to more aggressively inline vector-dense kernels
269+
/// and apply this bonus based on the percentage of vector instructions. A
270+
/// bonus is applied if the vector instructions exceed 50% and half that amount
271+
/// is applied if it exceeds 10%. Note that these bonuses are some what
272+
/// arbitrary and evolved over time by accident as much as because they are
273+
/// principled bonuses.
274+
/// FIXME: It would be nice to base the bonus values on something more
275+
/// scientific. A target may has no bonus on vector instructions.
276+
int getInlinerVectorBonusPercent() const;
277+
266278
/// Estimate the cost of an intrinsic when lowered.
267279
///
268280
/// Mirrors the \c getCallCost method but uses an intrinsic identifier.
@@ -1128,6 +1140,7 @@ class TargetTransformInfo::Concept {
11281140
virtual int getCallCost(const Function *F,
11291141
ArrayRef<const Value *> Arguments, const User *U) = 0;
11301142
virtual unsigned getInliningThresholdMultiplier() = 0;
1143+
virtual int getInlinerVectorBonusPercent() = 0;
11311144
virtual int getIntrinsicCost(Intrinsic::ID IID, Type *RetTy,
11321145
ArrayRef<Type *> ParamTys, const User *U) = 0;
11331146
virtual int getIntrinsicCost(Intrinsic::ID IID, Type *RetTy,
@@ -1351,6 +1364,9 @@ class TargetTransformInfo::Model final : public TargetTransformInfo::Concept {
13511364
unsigned getInliningThresholdMultiplier() override {
13521365
return Impl.getInliningThresholdMultiplier();
13531366
}
1367+
int getInlinerVectorBonusPercent() override {
1368+
return Impl.getInlinerVectorBonusPercent();
1369+
}
13541370
int getIntrinsicCost(Intrinsic::ID IID, Type *RetTy,
13551371
ArrayRef<Type *> ParamTys, const User *U = nullptr) override {
13561372
return Impl.getIntrinsicCost(IID, RetTy, ParamTys, U);

llvm/include/llvm/Analysis/TargetTransformInfoImpl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ class TargetTransformInfoImplBase {
140140

141141
unsigned getInliningThresholdMultiplier() { return 1; }
142142

143+
int getInlinerVectorBonusPercent() { return 150; }
144+
143145
unsigned getMemcpyCost(const Instruction *I) {
144146
return TTI::TCC_Expensive;
145147
}

llvm/include/llvm/CodeGen/AsmPrinter.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,12 @@ class AsmPrinter : public MachineFunctionPass {
543543
emitDwarfStringOffset(S.getEntry());
544544
}
545545

546+
/// Emit reference to a call site with a specified encoding
547+
void EmitCallSiteOffset(const MCSymbol *Hi, const MCSymbol *Lo,
548+
unsigned Encoding) const;
549+
/// Emit an integer value corresponding to the call site encoding
550+
void EmitCallSiteValue(uint64_t Value, unsigned Encoding) const;
551+
546552
/// Get the value for DW_AT_APPLE_isa. Zero if no isa encoding specified.
547553
virtual unsigned getISAEncoding() { return 0; }
548554

llvm/include/llvm/CodeGen/BasicTTIImpl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,8 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
427427

428428
unsigned getInliningThresholdMultiplier() { return 1; }
429429

430+
int getInlinerVectorBonusPercent() { return 150; }
431+
430432
void getUnrollingPreferences(Loop *L, ScalarEvolution &SE,
431433
TTI::UnrollingPreferences &UP) {
432434
// This unrolling functionality is target independent, but to provide some

llvm/include/llvm/CodeGen/SelectionDAGTargetInfo.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,14 @@ class SelectionDAGTargetInfo {
147147
return std::make_pair(SDValue(), SDValue());
148148
}
149149

150+
virtual SDValue EmitTargetCodeForSetTag(SelectionDAG &DAG, const SDLoc &dl,
151+
SDValue Chain, SDValue Addr,
152+
SDValue Size,
153+
MachinePointerInfo DstPtrInfo,
154+
bool ZeroData) const {
155+
return SDValue();
156+
}
157+
150158
// Return true when the decision to generate FMA's (or FMS, FMLA etc) rather
151159
// than FMUL and ADD is delegated to the machine combiner.
152160
virtual bool generateFMAsInMachineCombiner(CodeGenOpt::Level OptLevel) const {

llvm/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class CodeViewRecordStreamer {
3232
virtual void EmitBytes(StringRef Data) = 0;
3333
virtual void EmitIntValue(uint64_t Value, unsigned Size) = 0;
3434
virtual void EmitBinaryData(StringRef Data) = 0;
35+
virtual void AddComment(const Twine &T) = 0;
3536
virtual ~CodeViewRecordStreamer() = default;
3637
};
3738

@@ -59,7 +60,7 @@ class CodeViewRecordIO {
5960
Error beginRecord(Optional<uint32_t> MaxLength);
6061
Error endRecord();
6162

62-
Error mapInteger(TypeIndex &TypeInd);
63+
Error mapInteger(TypeIndex &TypeInd, const Twine &Comment = "");
6364

6465
bool isStreaming() const {
6566
return (Streamer != nullptr) && (Reader == nullptr) && (Writer == nullptr);
@@ -92,8 +93,9 @@ class CodeViewRecordIO {
9293
return Error::success();
9394
}
9495

95-
template <typename T> Error mapInteger(T &Value) {
96+
template <typename T> Error mapInteger(T &Value, const Twine &Comment = "") {
9697
if (isStreaming()) {
98+
emitComment(Comment);
9799
Streamer->EmitIntValue((int)Value, sizeof(T));
98100
incrStreamedLen(sizeof(T));
99101
return Error::success();
@@ -105,7 +107,7 @@ class CodeViewRecordIO {
105107
return Reader->readInteger(Value);
106108
}
107109

108-
template <typename T> Error mapEnum(T &Value) {
110+
template <typename T> Error mapEnum(T &Value, const Twine &Comment = "") {
109111
if (!isStreaming() && sizeof(Value) > maxFieldLength())
110112
return make_error<CodeViewError>(cv_error_code::insufficient_buffer);
111113

@@ -115,7 +117,7 @@ class CodeViewRecordIO {
115117
if (isWriting() || isStreaming())
116118
X = static_cast<U>(Value);
117119

118-
if (auto EC = mapInteger(X))
120+
if (auto EC = mapInteger(X, Comment))
119121
return EC;
120122

121123
if (isReading())
@@ -124,19 +126,22 @@ class CodeViewRecordIO {
124126
return Error::success();
125127
}
126128

127-
Error mapEncodedInteger(int64_t &Value);
128-
Error mapEncodedInteger(uint64_t &Value);
129-
Error mapEncodedInteger(APSInt &Value);
130-
Error mapStringZ(StringRef &Value);
131-
Error mapGuid(GUID &Guid);
129+
Error mapEncodedInteger(int64_t &Value, const Twine &Comment = "");
130+
Error mapEncodedInteger(uint64_t &Value, const Twine &Comment = "");
131+
Error mapEncodedInteger(APSInt &Value, const Twine &Comment = "");
132+
Error mapStringZ(StringRef &Value, const Twine &Comment = "");
133+
Error mapGuid(GUID &Guid, const Twine &Comment = "");
132134

133-
Error mapStringZVectorZ(std::vector<StringRef> &Value);
135+
Error mapStringZVectorZ(std::vector<StringRef> &Value,
136+
const Twine &Comment = "");
134137

135138
template <typename SizeType, typename T, typename ElementMapper>
136-
Error mapVectorN(T &Items, const ElementMapper &Mapper) {
139+
Error mapVectorN(T &Items, const ElementMapper &Mapper,
140+
const Twine &Comment = "") {
137141
SizeType Size;
138142
if (isStreaming()) {
139143
Size = static_cast<SizeType>(Items.size());
144+
emitComment(Comment);
140145
Streamer->EmitIntValue(Size, sizeof(Size));
141146
incrStreamedLen(sizeof(Size)); // add 1 for the delimiter
142147

@@ -168,7 +173,9 @@ class CodeViewRecordIO {
168173
}
169174

170175
template <typename T, typename ElementMapper>
171-
Error mapVectorTail(T &Items, const ElementMapper &Mapper) {
176+
Error mapVectorTail(T &Items, const ElementMapper &Mapper,
177+
const Twine &Comment = "") {
178+
emitComment(Comment);
172179
if (isStreaming() || isWriting()) {
173180
for (auto &Item : Items) {
174181
if (auto EC = Mapper(*this, Item))
@@ -186,8 +193,9 @@ class CodeViewRecordIO {
186193
return Error::success();
187194
}
188195

189-
Error mapByteVectorTail(ArrayRef<uint8_t> &Bytes);
190-
Error mapByteVectorTail(std::vector<uint8_t> &Bytes);
196+
Error mapByteVectorTail(ArrayRef<uint8_t> &Bytes, const Twine &Comment = "");
197+
Error mapByteVectorTail(std::vector<uint8_t> &Bytes,
198+
const Twine &Comment = "");
191199

192200
Error padToAlignment(uint32_t Align);
193201
Error skipPadding();
@@ -199,8 +207,10 @@ class CodeViewRecordIO {
199207
}
200208

201209
private:
202-
void emitEncodedSignedInteger(const int64_t &Value);
203-
void emitEncodedUnsignedInteger(const uint64_t &Value);
210+
void emitEncodedSignedInteger(const int64_t &Value,
211+
const Twine &Comment = "");
212+
void emitEncodedUnsignedInteger(const uint64_t &Value,
213+
const Twine &Comment = "");
204214
Error writeEncodedSignedInteger(const int64_t &Value);
205215
Error writeEncodedUnsignedInteger(const uint64_t &Value);
206216

@@ -214,6 +224,13 @@ class CodeViewRecordIO {
214224
StreamedLen = 4; // The record prefix is 4 bytes long
215225
}
216226

227+
void emitComment(const Twine &Comment) {
228+
if (isStreaming()) {
229+
Twine TComment(Comment);
230+
Streamer->AddComment(TComment);
231+
}
232+
}
233+
217234
struct RecordLimit {
218235
uint32_t BeginOffset;
219236
Optional<uint32_t> MaxLength;

llvm/include/llvm/DebugInfo/DWARF/DWARFRelocMap.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ namespace llvm {
2020
struct RelocAddrEntry {
2121
uint64_t SectionIndex;
2222
object::RelocationRef Reloc;
23-
object::RelocationResolver Resolver;
2423
uint64_t SymbolValue;
24+
Optional<object::RelocationRef> Reloc2;
25+
uint64_t SymbolValue2;
26+
object::RelocationResolver Resolver;
2527
};
2628

2729
/// In place of applying the relocations to the data we've read from disk we use

llvm/include/llvm/DebugInfo/PDB/DIA/DIAInjectedSource.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class DIAInjectedSource : public IPDBInjectedSource {
2525
std::string getFileName() const override;
2626
std::string getObjectFileName() const override;
2727
std::string getVirtualFileName() const override;
28-
PDB_SourceCompression getCompression() const override;
28+
uint32_t getCompression() const override;
2929
std::string getCode() const override;
3030

3131
private:

llvm/include/llvm/DebugInfo/PDB/IPDBInjectedSource.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#ifndef LLVM_DEBUGINFO_PDB_IPDBINJECTEDSOURCE_H
1010
#define LLVM_DEBUGINFO_PDB_IPDBINJECTEDSOURCE_H
1111

12-
#include "PDBTypes.h"
1312
#include "llvm/Support/raw_ostream.h"
1413
#include <memory>
1514
#include <string>
@@ -32,7 +31,10 @@ class IPDBInjectedSource {
3231
virtual std::string getFileName() const = 0;
3332
virtual std::string getObjectFileName() const = 0;
3433
virtual std::string getVirtualFileName() const = 0;
35-
virtual PDB_SourceCompression getCompression() const = 0;
34+
// The returned value depends on the PDB producer,
35+
// but 0 is guaranteed to mean "no compression".
36+
// The enum PDB_SourceCompression lists known return values.
37+
virtual uint32_t getCompression() const = 0;
3638
virtual std::string getCode() const = 0;
3739
};
3840
} // namespace pdb

llvm/include/llvm/DebugInfo/PDB/PDBExtras.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,12 @@ raw_ostream &operator<<(raw_ostream &OS, const PDB_SymType &Tag);
3737
raw_ostream &operator<<(raw_ostream &OS, const PDB_MemberAccess &Access);
3838
raw_ostream &operator<<(raw_ostream &OS, const PDB_UdtType &Type);
3939
raw_ostream &operator<<(raw_ostream &OS, const PDB_Machine &Machine);
40-
raw_ostream &operator<<(raw_ostream &OS,
41-
const PDB_SourceCompression &Compression);
4240

4341
raw_ostream &operator<<(raw_ostream &OS, const Variant &Value);
4442
raw_ostream &operator<<(raw_ostream &OS, const VersionInfo &Version);
4543
raw_ostream &operator<<(raw_ostream &OS, const TagStats &Stats);
4644

45+
raw_ostream& dumpPDBSourceCompression(raw_ostream& OS, uint32_t Compression);
4746

4847
template <typename T>
4948
void dumpSymbolField(raw_ostream &OS, StringRef Name, T Value, int Indent) {

0 commit comments

Comments
 (0)