Merge llvm, clang, compiler-rt, libc++, lld, and lldb release_80 branch

r355313, resolve conflicts, and bump version numbers.
This commit is contained in:
dim 2019-03-04 19:06:51 +00:00
parent 8c1b168863
commit 3e0b9a2ab6
12 changed files with 92 additions and 85 deletions

View File

@ -471,9 +471,18 @@ void AArch64AsmPrinter::EmitJumpTableInfo() {
const std::vector<MachineJumpTableEntry> &JT = MJTI->getJumpTables(); const std::vector<MachineJumpTableEntry> &JT = MJTI->getJumpTables();
if (JT.empty()) return; if (JT.empty()) return;
const Function &F = MF->getFunction();
const TargetLoweringObjectFile &TLOF = getObjFileLowering(); const TargetLoweringObjectFile &TLOF = getObjFileLowering();
MCSection *ReadOnlySec = TLOF.getSectionForJumpTable(MF->getFunction(), TM); bool JTInDiffSection =
OutStreamer->SwitchSection(ReadOnlySec); !STI->isTargetCOFF() ||
!TLOF.shouldPutJumpTableInFunctionSection(
MJTI->getEntryKind() == MachineJumpTableInfo::EK_LabelDifference32,
F);
if (JTInDiffSection) {
// Drop it in the readonly section.
MCSection *ReadOnlySec = TLOF.getSectionForJumpTable(F, TM);
OutStreamer->SwitchSection(ReadOnlySec);
}
auto AFI = MF->getInfo<AArch64FunctionInfo>(); auto AFI = MF->getInfo<AArch64FunctionInfo>();
for (unsigned JTI = 0, e = JT.size(); JTI != e; ++JTI) { for (unsigned JTI = 0, e = JT.size(); JTI != e; ++JTI) {

View File

@ -2108,9 +2108,6 @@ void AArch64FrameLowering::processFunctionBeforeFrameFinalized(
while (MBBI != MBB.end() && MBBI->getFlag(MachineInstr::FrameSetup)) while (MBBI != MBB.end() && MBBI->getFlag(MachineInstr::FrameSetup))
++MBBI; ++MBBI;
if (MBBI->isTerminator())
return;
// Create an UnwindHelp object. // Create an UnwindHelp object.
int UnwindHelpFI = int UnwindHelpFI =
MFI.CreateStackObject(/*size*/8, /*alignment*/16, false); MFI.CreateStackObject(/*size*/8, /*alignment*/16, false);
@ -2118,8 +2115,10 @@ void AArch64FrameLowering::processFunctionBeforeFrameFinalized(
// We need to store -2 into the UnwindHelp object at the start of the // We need to store -2 into the UnwindHelp object at the start of the
// function. // function.
DebugLoc DL; DebugLoc DL;
RS->enterBasicBlock(MBB); RS->enterBasicBlockEnd(MBB);
unsigned DstReg = RS->scavengeRegister(&AArch64::GPR64RegClass, MBBI, 0); RS->backward(std::prev(MBBI));
unsigned DstReg = RS->FindUnusedReg(&AArch64::GPR64commonRegClass);
assert(DstReg && "There must be a free register after frame setup");
BuildMI(MBB, MBBI, DL, TII.get(AArch64::MOVi64imm), DstReg).addImm(-2); BuildMI(MBB, MBBI, DL, TII.get(AArch64::MOVi64imm), DstReg).addImm(-2);
BuildMI(MBB, MBBI, DL, TII.get(AArch64::STURXi)) BuildMI(MBB, MBBI, DL, TII.get(AArch64::STURXi))
.addReg(DstReg, getKillRegState(true)) .addReg(DstReg, getKillRegState(true))

View File

@ -209,8 +209,8 @@ static std::string computeDataLayout(const Triple &TT,
static Reloc::Model getEffectiveRelocModel(const Triple &TT, static Reloc::Model getEffectiveRelocModel(const Triple &TT,
Optional<Reloc::Model> RM) { Optional<Reloc::Model> RM) {
// AArch64 Darwin is always PIC. // AArch64 Darwin and Windows are always PIC.
if (TT.isOSDarwin()) if (TT.isOSDarwin() || TT.isOSWindows())
return Reloc::PIC_; return Reloc::PIC_;
// On ELF platforms the default static relocation model has a smart enough // On ELF platforms the default static relocation model has a smart enough
// linker to cope with referencing external symbols defined in a shared // linker to cope with referencing external symbols defined in a shared

View File

@ -122,10 +122,3 @@ def : Pat<(select (i32 (seteq I32:$cond, 0)), I32:$lhs, I32:$rhs),
(SELECT_I32 I32:$rhs, I32:$lhs, I32:$cond)>; (SELECT_I32 I32:$rhs, I32:$lhs, I32:$cond)>;
def : Pat<(select (i32 (seteq I32:$cond, 0)), I64:$lhs, I64:$rhs), def : Pat<(select (i32 (seteq I32:$cond, 0)), I64:$lhs, I64:$rhs),
(SELECT_I64 I64:$rhs, I64:$lhs, I32:$cond)>; (SELECT_I64 I64:$rhs, I64:$lhs, I32:$cond)>;
// The legalizer inserts an unnecessary `and 1` to make input conform
// to getBooleanContents, which we can lower away.
def : Pat<(select (i32 (and I32:$cond, 1)), I32:$lhs, I32:$rhs),
(SELECT_I32 I32:$lhs, I32:$rhs, I32:$cond)>;
def : Pat<(select (i32 (and I32:$cond, 1)), I64:$lhs, I64:$rhs),
(SELECT_I64 I64:$lhs, I64:$rhs, I32:$cond)>;

View File

@ -38134,8 +38134,11 @@ static SDValue combineTruncatedArithmetic(SDNode *N, SelectionDAG &DAG,
return true; return true;
// See if this is a single use constant which can be constant folded. // See if this is a single use constant which can be constant folded.
SDValue BC = peekThroughOneUseBitcasts(Op); // NOTE: We don't peek throught bitcasts here because there is currently
return ISD::isBuildVectorOfConstantSDNodes(BC.getNode()); // no support for constant folding truncate+bitcast+vector_of_constants. So
// we'll just send up with a truncate on both operands which will
// get turned back into (truncate (binop)) causing an infinite loop.
return ISD::isBuildVectorOfConstantSDNodes(Op.getNode());
}; };
auto TruncateArithmetic = [&](SDValue N0, SDValue N1) { auto TruncateArithmetic = [&](SDValue N0, SDValue N1) {

View File

@ -3821,13 +3821,13 @@ The ``gnu_inline`` changes the meaning of ``extern inline`` to use GNU inline
semantics, meaning: semantics, meaning:
* If any declaration that is declared ``inline`` is not declared ``extern``, * If any declaration that is declared ``inline`` is not declared ``extern``,
then the ``inline`` keyword is just a hint. In particular, an out-of-line then the ``inline`` keyword is just a hint. In particular, an out-of-line
definition is still emitted for a function with external linkage, even if all definition is still emitted for a function with external linkage, even if all
call sites are inlined, unlike in C99 and C++ inline semantics. call sites are inlined, unlike in C99 and C++ inline semantics.
* If all declarations that are declared ``inline`` are also declared * If all declarations that are declared ``inline`` are also declared
``extern``, then the function body is present only for inlining and no ``extern``, then the function body is present only for inlining and no
out-of-line version is emitted. out-of-line version is emitted.
Some important consequences: ``static inline`` emits an out-of-line Some important consequences: ``static inline`` emits an out-of-line
version if needed, a plain ``inline`` definition emits an out-of-line version version if needed, a plain ``inline`` definition emits an out-of-line version

View File

@ -227,9 +227,7 @@ void openbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crtend))); CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crtend)));
} }
const char *Exec = Args.MakeArgString( const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
!NeedsSanitizerDeps ? ToolChain.GetLinkerPath()
: ToolChain.GetProgramPath("ld.lld"));
C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs)); C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs));
} }

View File

@ -433,14 +433,6 @@ void InitHeaderSearch::AddDefaultCPlusPlusIncludePaths(
case llvm::Triple::DragonFly: case llvm::Triple::DragonFly:
AddPath("/usr/include/c++/5.0", CXXSystem, false); AddPath("/usr/include/c++/5.0", CXXSystem, false);
break; break;
case llvm::Triple::OpenBSD: {
std::string t = triple.getTriple();
if (t.substr(0, 6) == "x86_64")
t.replace(0, 6, "amd64");
AddGnuCPlusPlusIncludePaths("/usr/include/g++",
t, "", "", triple);
break;
}
case llvm::Triple::Minix: case llvm::Triple::Minix:
AddGnuCPlusPlusIncludePaths("/usr/gnu/include/c++/4.4.3", AddGnuCPlusPlusIncludePaths("/usr/gnu/include/c++/4.4.3",
"", "", "", triple); "", "", "", triple);

View File

@ -18,7 +18,6 @@
#include "llvm/Support/EndianStream.h" #include "llvm/Support/EndianStream.h"
#include "llvm/Support/FileSystem.h" #include "llvm/Support/FileSystem.h"
#include "llvm/Support/FormatVariadic.h" #include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/JSON.h"
#include "llvm/Support/ScopedPrinter.h" #include "llvm/Support/ScopedPrinter.h"
#include "llvm/Support/YAMLTraits.h" #include "llvm/Support/YAMLTraits.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
@ -242,6 +241,31 @@ StackTrieNode *findOrCreateStackNode(
return CurrentStack; return CurrentStack;
} }
void writeTraceViewerRecord(uint16_t Version, raw_ostream &OS, int32_t FuncId,
uint32_t TId, uint32_t PId, bool Symbolize,
const FuncIdConversionHelper &FuncIdHelper,
double EventTimestampUs,
const StackTrieNode &StackCursor,
StringRef FunctionPhenotype) {
OS << " ";
if (Version >= 3) {
OS << llvm::formatv(
R"({ "name" : "{0}", "ph" : "{1}", "tid" : "{2}", "pid" : "{3}", )"
R"("ts" : "{4:f4}", "sf" : "{5}" })",
(Symbolize ? FuncIdHelper.SymbolOrNumber(FuncId)
: llvm::to_string(FuncId)),
FunctionPhenotype, TId, PId, EventTimestampUs,
StackCursor.ExtraData.id);
} else {
OS << llvm::formatv(
R"({ "name" : "{0}", "ph" : "{1}", "tid" : "{2}", "pid" : "1", )"
R"("ts" : "{3:f3}", "sf" : "{4}" })",
(Symbolize ? FuncIdHelper.SymbolOrNumber(FuncId)
: llvm::to_string(FuncId)),
FunctionPhenotype, TId, EventTimestampUs, StackCursor.ExtraData.id);
}
}
} // namespace } // namespace
void TraceConverter::exportAsChromeTraceEventFormat(const Trace &Records, void TraceConverter::exportAsChromeTraceEventFormat(const Trace &Records,
@ -252,14 +276,18 @@ void TraceConverter::exportAsChromeTraceEventFormat(const Trace &Records,
unsigned id_counter = 0; unsigned id_counter = 0;
OS << "{\n \"traceEvents\": [";
DenseMap<uint32_t, StackTrieNode *> StackCursorByThreadId{}; DenseMap<uint32_t, StackTrieNode *> StackCursorByThreadId{};
DenseMap<uint32_t, SmallVector<StackTrieNode *, 4>> StackRootsByThreadId{}; DenseMap<uint32_t, SmallVector<StackTrieNode *, 4>> StackRootsByThreadId{};
DenseMap<unsigned, StackTrieNode *> StacksByStackId{}; DenseMap<unsigned, StackTrieNode *> StacksByStackId{};
std::forward_list<StackTrieNode> NodeStore{}; std::forward_list<StackTrieNode> NodeStore{};
int loop_count = 0;
// Create a JSON Array which will hold all trace events.
json::Array TraceEvents;
for (const auto &R : Records) { for (const auto &R : Records) {
if (loop_count++ == 0)
OS << "\n";
else
OS << ",\n";
// Chrome trace event format always wants data in micros. // Chrome trace event format always wants data in micros.
// CyclesPerMicro = CycleHertz / 10^6 // CyclesPerMicro = CycleHertz / 10^6
// TSC / CyclesPerMicro == TSC * 10^6 / CycleHertz == MicroTimestamp // TSC / CyclesPerMicro == TSC * 10^6 / CycleHertz == MicroTimestamp
@ -284,15 +312,8 @@ void TraceConverter::exportAsChromeTraceEventFormat(const Trace &Records,
// type of B for begin or E for end, thread id, process id, // type of B for begin or E for end, thread id, process id,
// timestamp in microseconds, and a stack frame id. The ids are logged // timestamp in microseconds, and a stack frame id. The ids are logged
// in an id dictionary after the events. // in an id dictionary after the events.
TraceEvents.push_back(json::Object({ writeTraceViewerRecord(Version, OS, R.FuncId, R.TId, R.PId, Symbolize,
{"name", Symbolize ? FuncIdHelper.SymbolOrNumber(R.FuncId) FuncIdHelper, EventTimestampUs, *StackCursor, "B");
: llvm::to_string(R.FuncId)},
{"ph", "B"},
{"tid", llvm::to_string(R.TId)},
{"pid", llvm::to_string(Version >= 3 ? R.PId : 1)},
{"ts", llvm::formatv("{0:f4}", EventTimestampUs)},
{"sf", llvm::to_string(StackCursor->ExtraData.id)},
}));
break; break;
case RecordTypes::EXIT: case RecordTypes::EXIT:
case RecordTypes::TAIL_EXIT: case RecordTypes::TAIL_EXIT:
@ -303,51 +324,43 @@ void TraceConverter::exportAsChromeTraceEventFormat(const Trace &Records,
// (And/Or in loop termination below) // (And/Or in loop termination below)
StackTrieNode *PreviousCursor = nullptr; StackTrieNode *PreviousCursor = nullptr;
do { do {
TraceEvents.push_back(json::Object({ if (PreviousCursor != nullptr) {
{"name", Symbolize OS << ",\n";
? FuncIdHelper.SymbolOrNumber(StackCursor->FuncId) }
: llvm::to_string(StackCursor->FuncId)}, writeTraceViewerRecord(Version, OS, StackCursor->FuncId, R.TId, R.PId,
{"ph", "E"}, Symbolize, FuncIdHelper, EventTimestampUs,
{"tid", llvm::to_string(R.TId)}, *StackCursor, "E");
{"pid", llvm::to_string(Version >= 3 ? R.PId : 1)},
{"ts", llvm::formatv("{0:f4}", EventTimestampUs)},
{"sf", llvm::to_string(StackCursor->ExtraData.id)},
}));
PreviousCursor = StackCursor; PreviousCursor = StackCursor;
StackCursor = StackCursor->Parent; StackCursor = StackCursor->Parent;
} while (PreviousCursor->FuncId != R.FuncId && StackCursor != nullptr); } while (PreviousCursor->FuncId != R.FuncId && StackCursor != nullptr);
break; break;
} }
} }
OS << "\n ],\n"; // Close the Trace Events array.
OS << " "
<< "\"displayTimeUnit\": \"ns\",\n";
// The stackFrames dictionary substantially reduces size of the output file by // The stackFrames dictionary substantially reduces size of the output file by
// avoiding repeating the entire call stack of function names for each entry. // avoiding repeating the entire call stack of function names for each entry.
json::Object StackFrames; OS << R"( "stackFrames": {)";
for (const auto &Stack : StacksByStackId) { int stack_frame_count = 0;
const auto &StackId = Stack.first; for (auto map_iter : StacksByStackId) {
const auto &StackFunctionNode = Stack.second; if (stack_frame_count++ == 0)
json::Object::iterator It; OS << "\n";
std::tie(It, std::ignore) = StackFrames.insert({ else
llvm::to_string(StackId), OS << ",\n";
json::Object{ OS << " ";
{"name", OS << llvm::formatv(
Symbolize ? FuncIdHelper.SymbolOrNumber(StackFunctionNode->FuncId) R"("{0}" : { "name" : "{1}")", map_iter.first,
: llvm::to_string(StackFunctionNode->FuncId)}}, (Symbolize ? FuncIdHelper.SymbolOrNumber(map_iter.second->FuncId)
}); : llvm::to_string(map_iter.second->FuncId)));
if (map_iter.second->Parent != nullptr)
if (StackFunctionNode->Parent != nullptr) OS << llvm::formatv(R"(, "parent": "{0}")",
It->second.getAsObject()->insert( map_iter.second->Parent->ExtraData.id);
{"parent", llvm::to_string(StackFunctionNode->Parent->ExtraData.id)}); OS << " }";
} }
OS << "\n }\n"; // Close the stack frames map.
json::Object TraceJSON{ OS << "}\n"; // Close the JSON entry.
{"displayTimeUnit", "ns"},
{"traceEvents", std::move(TraceEvents)},
{"stackFrames", std::move(StackFrames)},
};
// Pretty-print the JSON using two spaces for indentations.
OS << formatv("{0:2}", json::Value(std::move(TraceJSON)));
} }
namespace llvm { namespace llvm {

View File

@ -8,4 +8,4 @@
#define CLANG_VENDOR "FreeBSD " #define CLANG_VENDOR "FreeBSD "
#define SVN_REVISION "354799" #define SVN_REVISION "355313"

View File

@ -7,4 +7,4 @@
#define LLD_REPOSITORY_STRING "FreeBSD" #define LLD_REPOSITORY_STRING "FreeBSD"
// <Upstream revision at import>-<Local identifier in __FreeBSD_version style> // <Upstream revision at import>-<Local identifier in __FreeBSD_version style>
#define LLD_REVISION_STRING "354799-1300002" #define LLD_REVISION_STRING "355313-1300002"

View File

@ -1,2 +1,2 @@
/* $FreeBSD$ */ /* $FreeBSD$ */
#define LLVM_REVISION "svn-r354799" #define LLVM_REVISION "svn-r355313"