Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
5.0.1 release (upstream r320880). Relnotes: yes MFC after: 2 weeks
This commit is contained in:
@@ -578,11 +578,15 @@ BPFTargetLowering::EmitInstrWithCustomInserter(MachineInstr &MI,
|
||||
.addReg(LHS)
|
||||
.addReg(MI.getOperand(2).getReg())
|
||||
.addMBB(Copy1MBB);
|
||||
else
|
||||
else {
|
||||
int64_t imm32 = MI.getOperand(2).getImm();
|
||||
// sanity check before we build J*_ri instruction.
|
||||
assert (isInt<32>(imm32));
|
||||
BuildMI(BB, DL, TII.get(NewCC))
|
||||
.addReg(LHS)
|
||||
.addImm(MI.getOperand(2).getImm())
|
||||
.addImm(imm32)
|
||||
.addMBB(Copy1MBB);
|
||||
}
|
||||
|
||||
// Copy0MBB:
|
||||
// %FalseValue = ...
|
||||
|
||||
@@ -464,7 +464,7 @@ let usesCustomInserter = 1 in {
|
||||
(ins GPR:$lhs, i64imm:$rhs, i64imm:$imm, GPR:$src, GPR:$src2),
|
||||
"# Select PSEUDO $dst = $lhs $imm $rhs ? $src : $src2",
|
||||
[(set i64:$dst,
|
||||
(BPFselectcc i64:$lhs, (i64 imm:$rhs), (i64 imm:$imm), i64:$src, i64:$src2))]>;
|
||||
(BPFselectcc i64:$lhs, (i64 i64immSExt32:$rhs), (i64 imm:$imm), i64:$src, i64:$src2))]>;
|
||||
}
|
||||
|
||||
// load 64-bit global addr into register
|
||||
|
||||
@@ -586,8 +586,8 @@ class NewGVN {
|
||||
private:
|
||||
// Expression handling.
|
||||
const Expression *createExpression(Instruction *) const;
|
||||
const Expression *createBinaryExpression(unsigned, Type *, Value *,
|
||||
Value *) const;
|
||||
const Expression *createBinaryExpression(unsigned, Type *, Value *, Value *,
|
||||
Instruction *) const;
|
||||
PHIExpression *createPHIExpression(Instruction *, bool &HasBackEdge,
|
||||
bool &OriginalOpsConstant) const;
|
||||
const DeadExpression *createDeadExpression() const;
|
||||
@@ -902,8 +902,8 @@ bool NewGVN::setBasicExpressionInfo(Instruction *I, BasicExpression *E) const {
|
||||
}
|
||||
|
||||
const Expression *NewGVN::createBinaryExpression(unsigned Opcode, Type *T,
|
||||
Value *Arg1,
|
||||
Value *Arg2) const {
|
||||
Value *Arg1, Value *Arg2,
|
||||
Instruction *I) const {
|
||||
auto *E = new (ExpressionAllocator) BasicExpression(2);
|
||||
|
||||
E->setType(T);
|
||||
@@ -921,7 +921,7 @@ const Expression *NewGVN::createBinaryExpression(unsigned Opcode, Type *T,
|
||||
E->op_push_back(lookupOperandLeader(Arg2));
|
||||
|
||||
Value *V = SimplifyBinOp(Opcode, E->getOperand(0), E->getOperand(1), SQ);
|
||||
if (const Expression *SimplifiedE = checkSimplificationResults(E, nullptr, V))
|
||||
if (const Expression *SimplifiedE = checkSimplificationResults(E, I, V))
|
||||
return SimplifiedE;
|
||||
return E;
|
||||
}
|
||||
@@ -1699,8 +1699,9 @@ NewGVN::performSymbolicAggrValueEvaluation(Instruction *I) const {
|
||||
// expression.
|
||||
assert(II->getNumArgOperands() == 2 &&
|
||||
"Expect two args for recognised intrinsics.");
|
||||
return createBinaryExpression(
|
||||
Opcode, EI->getType(), II->getArgOperand(0), II->getArgOperand(1));
|
||||
return createBinaryExpression(Opcode, EI->getType(),
|
||||
II->getArgOperand(0),
|
||||
II->getArgOperand(1), I);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1933,6 +1934,7 @@ void NewGVN::touchAndErase(Map &M, const KeyType &Key) {
|
||||
}
|
||||
|
||||
void NewGVN::addAdditionalUsers(Value *To, Value *User) const {
|
||||
assert(User && To != User);
|
||||
if (isa<Instruction>(To))
|
||||
AdditionalUsers[To].insert(User);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ std::string getClangRepositoryPath() {
|
||||
|
||||
// If the SVN_REPOSITORY is empty, try to use the SVN keyword. This helps us
|
||||
// pick up a tag in an SVN export, for example.
|
||||
StringRef SVNRepository("$URL: https://llvm.org/svn/llvm-project/cfe/branches/release_50/lib/Basic/Version.cpp $");
|
||||
StringRef SVNRepository("$URL: https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_501/final/lib/Basic/Version.cpp $");
|
||||
if (URL.empty()) {
|
||||
URL = SVNRepository.slice(SVNRepository.find(':'),
|
||||
SVNRepository.find("/lib/Basic"));
|
||||
|
||||
@@ -1603,7 +1603,24 @@ static bool ShouldDiagnoseUnusedDecl(const NamedDecl *D) {
|
||||
if (D->isInvalidDecl())
|
||||
return false;
|
||||
|
||||
if (D->isReferenced() || D->isUsed() || D->hasAttr<UnusedAttr>() ||
|
||||
bool Referenced = false;
|
||||
if (auto *DD = dyn_cast<DecompositionDecl>(D)) {
|
||||
// For a decomposition declaration, warn if none of the bindings are
|
||||
// referenced, instead of if the variable itself is referenced (which
|
||||
// it is, by the bindings' expressions).
|
||||
for (auto *BD : DD->bindings()) {
|
||||
if (BD->isReferenced()) {
|
||||
Referenced = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (!D->getDeclName()) {
|
||||
return false;
|
||||
} else if (D->isReferenced() || D->isUsed()) {
|
||||
Referenced = true;
|
||||
}
|
||||
|
||||
if (Referenced || D->hasAttr<UnusedAttr>() ||
|
||||
D->hasAttr<ObjCPreciseLifetimeAttr>())
|
||||
return false;
|
||||
|
||||
@@ -1726,7 +1743,7 @@ void Sema::DiagnoseUnusedDecl(const NamedDecl *D) {
|
||||
else
|
||||
DiagID = diag::warn_unused_variable;
|
||||
|
||||
Diag(D->getLocation(), DiagID) << D->getDeclName() << Hint;
|
||||
Diag(D->getLocation(), DiagID) << D << Hint;
|
||||
}
|
||||
|
||||
static void CheckPoppedLabel(LabelDecl *L, Sema &S) {
|
||||
@@ -1756,8 +1773,6 @@ void Sema::ActOnPopScope(SourceLocation Loc, Scope *S) {
|
||||
assert(isa<NamedDecl>(TmpD) && "Decl isn't NamedDecl?");
|
||||
NamedDecl *D = cast<NamedDecl>(TmpD);
|
||||
|
||||
if (!D->getDeclName()) continue;
|
||||
|
||||
// Diagnose unused variables in this scope.
|
||||
if (!S->hasUnrecoverableErrorOccurred()) {
|
||||
DiagnoseUnusedDecl(D);
|
||||
@@ -1765,6 +1780,8 @@ void Sema::ActOnPopScope(SourceLocation Loc, Scope *S) {
|
||||
DiagnoseUnusedNestedTypedefs(RD);
|
||||
}
|
||||
|
||||
if (!D->getDeclName()) continue;
|
||||
|
||||
// If this was a forward reference to a label, verify it was defined.
|
||||
if (LabelDecl *LD = dyn_cast<LabelDecl>(D))
|
||||
CheckPoppedLabel(LD, *this);
|
||||
@@ -6155,7 +6172,6 @@ NamedDecl *Sema::ActOnVariableDeclarator(
|
||||
IdentifierInfo *II = Name.getAsIdentifierInfo();
|
||||
|
||||
if (D.isDecompositionDeclarator()) {
|
||||
AddToScope = false;
|
||||
// Take the name of the first declarator as our name for diagnostic
|
||||
// purposes.
|
||||
auto &Decomp = D.getDecompositionDeclarator();
|
||||
|
||||
@@ -826,7 +826,10 @@ Sema::ActOnDecompositionDeclarator(Scope *S, Declarator &D,
|
||||
NamedDecl *New =
|
||||
ActOnVariableDeclarator(S, D, DC, TInfo, Previous,
|
||||
MultiTemplateParamsArg(), AddToScope, Bindings);
|
||||
CurContext->addHiddenDecl(New);
|
||||
if (AddToScope) {
|
||||
S->AddDecl(New);
|
||||
CurContext->addHiddenDecl(New);
|
||||
}
|
||||
|
||||
if (isInOpenMPDeclareTargetContext())
|
||||
checkDeclIsAllowedInOpenMPTarget(nullptr, New);
|
||||
|
||||
@@ -677,6 +677,7 @@ TemplateDeclInstantiator::VisitTypeAliasTemplateDecl(TypeAliasTemplateDecl *D) {
|
||||
Decl *TemplateDeclInstantiator::VisitBindingDecl(BindingDecl *D) {
|
||||
auto *NewBD = BindingDecl::Create(SemaRef.Context, Owner, D->getLocation(),
|
||||
D->getIdentifier());
|
||||
NewBD->setReferenced(D->isReferenced());
|
||||
SemaRef.CurrentInstantiationScope->InstantiatedLocal(D, NewBD);
|
||||
return NewBD;
|
||||
}
|
||||
|
||||
@@ -112,6 +112,10 @@ class ArchHandler {
|
||||
/// info in final executables.
|
||||
virtual bool isLazyPointer(const Reference &);
|
||||
|
||||
/// Reference from an __stub_helper entry to the required offset of the
|
||||
/// lazy bind commands.
|
||||
virtual Reference::KindValue lazyImmediateLocationKind() = 0;
|
||||
|
||||
/// Returns true if the specified relocation is paired to the next relocation.
|
||||
virtual bool isPairedReloc(const normalized::Relocation &) = 0;
|
||||
|
||||
|
||||
@@ -67,6 +67,10 @@ class ArchHandler_arm : public ArchHandler {
|
||||
return invalid;
|
||||
}
|
||||
|
||||
Reference::KindValue lazyImmediateLocationKind() override {
|
||||
return lazyImmediateLocation;
|
||||
}
|
||||
|
||||
Reference::KindValue pointerKind() override {
|
||||
return invalid;
|
||||
}
|
||||
|
||||
@@ -127,6 +127,10 @@ class ArchHandler_arm64 : public ArchHandler {
|
||||
return pointer64;
|
||||
}
|
||||
|
||||
Reference::KindValue lazyImmediateLocationKind() override {
|
||||
return lazyImmediateLocation;
|
||||
}
|
||||
|
||||
uint32_t dwarfCompactUnwindType() override {
|
||||
return 0x03000000;
|
||||
}
|
||||
|
||||
@@ -70,6 +70,10 @@ class ArchHandler_x86 : public ArchHandler {
|
||||
return delta32;
|
||||
}
|
||||
|
||||
Reference::KindValue lazyImmediateLocationKind() override {
|
||||
return lazyImmediateLocation;
|
||||
}
|
||||
|
||||
Reference::KindValue unwindRefToEhFrameKind() override {
|
||||
return invalid;
|
||||
}
|
||||
|
||||
@@ -116,6 +116,10 @@ class ArchHandler_x86_64 : public ArchHandler {
|
||||
return unwindFDEToFunction;
|
||||
}
|
||||
|
||||
Reference::KindValue lazyImmediateLocationKind() override {
|
||||
return lazyImmediateLocation;
|
||||
}
|
||||
|
||||
Reference::KindValue unwindRefToEhFrameKind() override {
|
||||
return unwindInfoToEhFrame;
|
||||
}
|
||||
|
||||
@@ -172,6 +172,8 @@ class Util {
|
||||
SymbolScope &symbolScope);
|
||||
void appendSection(SectionInfo *si, NormalizedFile &file);
|
||||
uint32_t sectionIndexForAtom(const Atom *atom);
|
||||
void fixLazyReferenceImm(const DefinedAtom *atom, uint32_t offset,
|
||||
NormalizedFile &file);
|
||||
|
||||
typedef llvm::DenseMap<const Atom*, uint32_t> AtomToIndex;
|
||||
struct AtomAndIndex { const Atom *atom; uint32_t index; SymbolScope scope; };
|
||||
@@ -1423,6 +1425,8 @@ void Util::addRebaseAndBindingInfo(const lld::File &atomFile,
|
||||
|
||||
uint8_t segmentIndex;
|
||||
uint64_t segmentStartAddr;
|
||||
uint32_t offsetInBindInfo = 0;
|
||||
|
||||
for (SectionInfo *sect : _sectionInfos) {
|
||||
segIndexForSection(sect, segmentIndex, segmentStartAddr);
|
||||
for (const AtomInfo &info : sect->atomsAndOffsets) {
|
||||
@@ -1467,6 +1471,59 @@ void Util::addRebaseAndBindingInfo(const lld::File &atomFile,
|
||||
bind.symbolName = targ->name();
|
||||
bind.addend = ref->addend();
|
||||
nFile.lazyBindingInfo.push_back(bind);
|
||||
|
||||
// Now that we know the segmentOffset and the ordinal attribute,
|
||||
// we can fix the helper's code
|
||||
|
||||
fixLazyReferenceImm(atom, offsetInBindInfo, nFile);
|
||||
|
||||
// 5 bytes for opcodes + variable sizes (target name + \0 and offset
|
||||
// encode's size)
|
||||
offsetInBindInfo +=
|
||||
6 + targ->name().size() + llvm::getULEB128Size(bind.segOffset);
|
||||
if (bind.ordinal > BIND_IMMEDIATE_MASK)
|
||||
offsetInBindInfo += llvm::getULEB128Size(bind.ordinal);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Util::fixLazyReferenceImm(const DefinedAtom *atom, uint32_t offset,
|
||||
NormalizedFile &file) {
|
||||
for (const auto &ref : *atom) {
|
||||
const DefinedAtom *da = dyn_cast<DefinedAtom>(ref->target());
|
||||
if (da == nullptr)
|
||||
return;
|
||||
|
||||
const Reference *helperRef = nullptr;
|
||||
for (const Reference *hr : *da) {
|
||||
if (hr->kindValue() == _archHandler.lazyImmediateLocationKind()) {
|
||||
helperRef = hr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (helperRef == nullptr)
|
||||
continue;
|
||||
|
||||
// TODO: maybe get the fixed atom content from _archHandler ?
|
||||
for (SectionInfo *sectInfo : _sectionInfos) {
|
||||
for (const AtomInfo &atomInfo : sectInfo->atomsAndOffsets) {
|
||||
if (atomInfo.atom == helperRef->target()) {
|
||||
auto sectionContent =
|
||||
file.sections[sectInfo->normalizedSectionIndex].content;
|
||||
uint8_t *rawb =
|
||||
file.ownedAllocations.Allocate<uint8_t>(sectionContent.size());
|
||||
llvm::MutableArrayRef<uint8_t> newContent{rawb,
|
||||
sectionContent.size()};
|
||||
std::copy(sectionContent.begin(), sectionContent.end(),
|
||||
newContent.begin());
|
||||
llvm::support::ulittle32_t *loc =
|
||||
reinterpret_cast<llvm::support::ulittle32_t *>(
|
||||
&newContent[atomInfo.offsetInSection +
|
||||
helperRef->offsetInAtom()]);
|
||||
*loc = offset;
|
||||
file.sections[sectInfo->normalizedSectionIndex].content = newContent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@
|
||||
|
||||
#define CLANG_VENDOR "FreeBSD "
|
||||
|
||||
#define SVN_REVISION "319231"
|
||||
#define SVN_REVISION "320880"
|
||||
|
||||
@@ -4,5 +4,5 @@
|
||||
#define LLD_VERSION_STRING "5.0.1"
|
||||
#define LLD_VERSION_MAJOR 5
|
||||
#define LLD_VERSION_MINOR 0
|
||||
#define LLD_REVISION_STRING "319231"
|
||||
#define LLD_REVISION_STRING "320880"
|
||||
#define LLD_REPOSITORY_STRING "FreeBSD"
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
/* $FreeBSD$ */
|
||||
#define LLVM_REVISION "svn-r319231"
|
||||
#define LLVM_REVISION "svn-r320880"
|
||||
|
||||
Reference in New Issue
Block a user