svn commit: r314177 - in projects/clang400-import: contrib/llvm/lib/CodeGen/AsmPrinter contrib/llvm/lib/Target/AArch64 contrib/llvm/lib/Target/ARM contrib/llvm/lib/Transforms/Scalar contrib/llvm/to...
Dimitry Andric
dim at FreeBSD.org
Thu Feb 23 19:25:32 UTC 2017
Author: dim
Date: Thu Feb 23 19:25:29 2017
New Revision: 314177
URL: https://svnweb.freebsd.org/changeset/base/314177
Log:
Merge llvm, clang, compiler-rt, libc++, lld and lldb release_40 branch
r296002, and update build glue.
Modified:
projects/clang400-import/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
projects/clang400-import/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
projects/clang400-import/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
projects/clang400-import/contrib/llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
projects/clang400-import/contrib/llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp
projects/clang400-import/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp
projects/clang400-import/contrib/llvm/lib/Transforms/Scalar/LICM.cpp
projects/clang400-import/contrib/llvm/tools/clang/lib/CodeGen/CGOpenMPRuntime.cpp
projects/clang400-import/contrib/llvm/tools/clang/lib/Driver/Tools.cpp
projects/clang400-import/contrib/llvm/tools/clang/lib/Sema/SemaType.cpp
projects/clang400-import/lib/clang/include/clang/Basic/Version.inc
projects/clang400-import/lib/clang/include/lld/Config/Version.inc
Directory Properties:
projects/clang400-import/contrib/compiler-rt/ (props changed)
projects/clang400-import/contrib/libc++/ (props changed)
projects/clang400-import/contrib/llvm/ (props changed)
projects/clang400-import/contrib/llvm/tools/clang/ (props changed)
projects/clang400-import/contrib/llvm/tools/lld/ (props changed)
projects/clang400-import/contrib/llvm/tools/lldb/ (props changed)
Modified: projects/clang400-import/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
==============================================================================
--- projects/clang400-import/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Thu Feb 23 19:21:47 2017 (r314176)
+++ projects/clang400-import/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Thu Feb 23 19:25:29 2017 (r314177)
@@ -522,22 +522,19 @@ DIE *DwarfCompileUnit::constructVariable
}
// .. else use frame index.
- if (DV.getFrameIndex().empty())
+ if (!DV.hasFrameIndexExprs())
return VariableDie;
- auto Expr = DV.getExpression().begin();
DIELoc *Loc = new (DIEValueAllocator) DIELoc;
DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc);
- for (auto FI : DV.getFrameIndex()) {
+ for (auto &Fragment : DV.getFrameIndexExprs()) {
unsigned FrameReg = 0;
const TargetFrameLowering *TFI = Asm->MF->getSubtarget().getFrameLowering();
- int Offset = TFI->getFrameIndexReference(*Asm->MF, FI, FrameReg);
- assert(Expr != DV.getExpression().end() && "Wrong number of expressions");
- DwarfExpr.addFragmentOffset(*Expr);
+ int Offset = TFI->getFrameIndexReference(*Asm->MF, Fragment.FI, FrameReg);
+ DwarfExpr.addFragmentOffset(Fragment.Expr);
DwarfExpr.AddMachineRegIndirect(*Asm->MF->getSubtarget().getRegisterInfo(),
FrameReg, Offset);
- DwarfExpr.AddExpression(*Expr);
- ++Expr;
+ DwarfExpr.AddExpression(Fragment.Expr);
}
addBlock(*VariableDie, dwarf::DW_AT_location, DwarfExpr.finalize());
Modified: projects/clang400-import/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
==============================================================================
--- projects/clang400-import/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Thu Feb 23 19:21:47 2017 (r314176)
+++ projects/clang400-import/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Thu Feb 23 19:25:29 2017 (r314177)
@@ -199,6 +199,15 @@ const DIType *DbgVariable::getType() con
return Ty;
}
+ArrayRef<DbgVariable::FrameIndexExpr> DbgVariable::getFrameIndexExprs() const {
+ std::sort(FrameIndexExprs.begin(), FrameIndexExprs.end(),
+ [](const FrameIndexExpr &A, const FrameIndexExpr &B) -> bool {
+ return A.Expr->getFragmentInfo()->OffsetInBits <
+ B.Expr->getFragmentInfo()->OffsetInBits;
+ });
+ return FrameIndexExprs;
+}
+
static const DwarfAccelTable::Atom TypeAtoms[] = {
DwarfAccelTable::Atom(dwarf::DW_ATOM_die_offset, dwarf::DW_FORM_data4),
DwarfAccelTable::Atom(dwarf::DW_ATOM_die_tag, dwarf::DW_FORM_data2),
Modified: projects/clang400-import/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
==============================================================================
--- projects/clang400-import/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h Thu Feb 23 19:21:47 2017 (r314176)
+++ projects/clang400-import/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h Thu Feb 23 19:25:29 2017 (r314177)
@@ -54,7 +54,7 @@ class MachineModuleInfo;
///
/// Variables can be created from allocas, in which case they're generated from
/// the MMI table. Such variables can have multiple expressions and frame
-/// indices. The \a Expr and \a FrameIndices array must match.
+/// indices.
///
/// Variables can be created from \c DBG_VALUE instructions. Those whose
/// location changes over time use \a DebugLocListIndex, while those with a
@@ -64,11 +64,16 @@ class MachineModuleInfo;
class DbgVariable {
const DILocalVariable *Var; /// Variable Descriptor.
const DILocation *IA; /// Inlined at location.
- SmallVector<const DIExpression *, 1> Expr; /// Complex address.
DIE *TheDIE = nullptr; /// Variable DIE.
unsigned DebugLocListIndex = ~0u; /// Offset in DebugLocs.
const MachineInstr *MInsn = nullptr; /// DBG_VALUE instruction.
- SmallVector<int, 1> FrameIndex; /// Frame index.
+
+ struct FrameIndexExpr {
+ int FI;
+ const DIExpression *Expr;
+ };
+ mutable SmallVector<FrameIndexExpr, 1>
+ FrameIndexExprs; /// Frame index + expression.
public:
/// Construct a DbgVariable.
@@ -80,21 +85,18 @@ public:
/// Initialize from the MMI table.
void initializeMMI(const DIExpression *E, int FI) {
- assert(Expr.empty() && "Already initialized?");
- assert(FrameIndex.empty() && "Already initialized?");
+ assert(FrameIndexExprs.empty() && "Already initialized?");
assert(!MInsn && "Already initialized?");
assert((!E || E->isValid()) && "Expected valid expression");
assert(~FI && "Expected valid index");
- Expr.push_back(E);
- FrameIndex.push_back(FI);
+ FrameIndexExprs.push_back({FI, E});
}
/// Initialize from a DBG_VALUE instruction.
void initializeDbgValue(const MachineInstr *DbgValue) {
- assert(Expr.empty() && "Already initialized?");
- assert(FrameIndex.empty() && "Already initialized?");
+ assert(FrameIndexExprs.empty() && "Already initialized?");
assert(!MInsn && "Already initialized?");
assert(Var == DbgValue->getDebugVariable() && "Wrong variable");
@@ -103,16 +105,15 @@ public:
MInsn = DbgValue;
if (auto *E = DbgValue->getDebugExpression())
if (E->getNumElements())
- Expr.push_back(E);
+ FrameIndexExprs.push_back({0, E});
}
// Accessors.
const DILocalVariable *getVariable() const { return Var; }
const DILocation *getInlinedAt() const { return IA; }
- ArrayRef<const DIExpression *> getExpression() const { return Expr; }
const DIExpression *getSingleExpression() const {
- assert(MInsn && Expr.size() <= 1);
- return Expr.size() ? Expr[0] : nullptr;
+ assert(MInsn && FrameIndexExprs.size() <= 1);
+ return FrameIndexExprs.size() ? FrameIndexExprs[0].Expr : nullptr;
}
void setDIE(DIE &D) { TheDIE = &D; }
DIE *getDIE() const { return TheDIE; }
@@ -120,7 +121,9 @@ public:
unsigned getDebugLocListIndex() const { return DebugLocListIndex; }
StringRef getName() const { return Var->getName(); }
const MachineInstr *getMInsn() const { return MInsn; }
- ArrayRef<int> getFrameIndex() const { return FrameIndex; }
+ /// Get the FI entries, sorted by fragment offset.
+ ArrayRef<FrameIndexExpr> getFrameIndexExprs() const;
+ bool hasFrameIndexExprs() const { return !FrameIndexExprs.empty(); }
void addMMIEntry(const DbgVariable &V) {
assert(DebugLocListIndex == ~0U && !MInsn && "not an MMI entry");
@@ -128,16 +131,15 @@ public:
assert(V.Var == Var && "conflicting variable");
assert(V.IA == IA && "conflicting inlined-at location");
- assert(!FrameIndex.empty() && "Expected an MMI entry");
- assert(!V.FrameIndex.empty() && "Expected an MMI entry");
- assert(Expr.size() == FrameIndex.size() && "Mismatched expressions");
- assert(V.Expr.size() == V.FrameIndex.size() && "Mismatched expressions");
-
- Expr.append(V.Expr.begin(), V.Expr.end());
- FrameIndex.append(V.FrameIndex.begin(), V.FrameIndex.end());
- assert(all_of(Expr, [](const DIExpression *E) {
- return E && E->isFragment();
- }) && "conflicting locations for variable");
+ assert(!FrameIndexExprs.empty() && "Expected an MMI entry");
+ assert(!V.FrameIndexExprs.empty() && "Expected an MMI entry");
+
+ FrameIndexExprs.append(V.FrameIndexExprs.begin(), V.FrameIndexExprs.end());
+ assert(all_of(FrameIndexExprs,
+ [](FrameIndexExpr &FIE) {
+ return FIE.Expr && FIE.Expr->isFragment();
+ }) &&
+ "conflicting locations for variable");
}
// Translate tag to proper Dwarf tag.
@@ -167,11 +169,11 @@ public:
bool hasComplexAddress() const {
assert(MInsn && "Expected DBG_VALUE, not MMI variable");
- assert(FrameIndex.empty() && "Expected DBG_VALUE, not MMI variable");
- assert(
- (Expr.empty() || (Expr.size() == 1 && Expr.back()->getNumElements())) &&
- "Invalid Expr for DBG_VALUE");
- return !Expr.empty();
+ assert((FrameIndexExprs.empty() ||
+ (FrameIndexExprs.size() == 1 &&
+ FrameIndexExprs[0].Expr->getNumElements())) &&
+ "Invalid Expr for DBG_VALUE");
+ return !FrameIndexExprs.empty();
}
bool isBlockByrefVariable() const;
const DIType *getType() const;
Modified: projects/clang400-import/contrib/llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
==============================================================================
--- projects/clang400-import/contrib/llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp Thu Feb 23 19:21:47 2017 (r314176)
+++ projects/clang400-import/contrib/llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp Thu Feb 23 19:25:29 2017 (r314177)
@@ -853,9 +853,11 @@ AArch64LoadStoreOpt::promoteLoadFromStor
.addImm(Imms);
}
}
- StoreI->clearRegisterKills(StRt, TRI);
- (void)BitExtMI;
+ // Clear kill flags between store and load.
+ for (MachineInstr &MI : make_range(StoreI->getIterator(),
+ BitExtMI->getIterator()))
+ MI.clearRegisterKills(StRt, TRI);
DEBUG(dbgs() << "Promoting load by replacing :\n ");
DEBUG(StoreI->print(dbgs()));
Modified: projects/clang400-import/contrib/llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp
==============================================================================
--- projects/clang400-import/contrib/llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp Thu Feb 23 19:21:47 2017 (r314176)
+++ projects/clang400-import/contrib/llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp Thu Feb 23 19:25:29 2017 (r314177)
@@ -1225,16 +1225,36 @@ bool ARMExpandPseudo::ExpandMI(MachineBa
}
case ARM::tTPsoft:
case ARM::TPsoft: {
+ const bool Thumb = Opcode == ARM::tTPsoft;
+
MachineInstrBuilder MIB;
- if (Opcode == ARM::tTPsoft)
+ if (STI->genLongCalls()) {
+ MachineFunction *MF = MBB.getParent();
+ MachineConstantPool *MCP = MF->getConstantPool();
+ unsigned PCLabelID = AFI->createPICLabelUId();
+ MachineConstantPoolValue *CPV =
+ ARMConstantPoolSymbol::Create(MF->getFunction()->getContext(),
+ "__aeabi_read_tp", PCLabelID, 0);
+ unsigned Reg = MI.getOperand(0).getReg();
MIB = BuildMI(MBB, MBBI, MI.getDebugLoc(),
- TII->get( ARM::tBL))
- .addImm((unsigned)ARMCC::AL).addReg(0)
- .addExternalSymbol("__aeabi_read_tp", 0);
- else
+ TII->get(Thumb ? ARM::tLDRpci : ARM::LDRi12), Reg)
+ .addConstantPoolIndex(MCP->getConstantPoolIndex(CPV, 4));
+ if (!Thumb)
+ MIB.addImm(0);
+ MIB.addImm(static_cast<unsigned>(ARMCC::AL)).addReg(0);
+
MIB = BuildMI(MBB, MBBI, MI.getDebugLoc(),
- TII->get( ARM::BL))
- .addExternalSymbol("__aeabi_read_tp", 0);
+ TII->get(Thumb ? ARM::tBLXr : ARM::BLX));
+ if (Thumb)
+ MIB.addImm(static_cast<unsigned>(ARMCC::AL)).addReg(0);
+ MIB.addReg(Reg, RegState::Kill);
+ } else {
+ MIB = BuildMI(MBB, MBBI, MI.getDebugLoc(),
+ TII->get(Thumb ? ARM::tBL : ARM::BL));
+ if (Thumb)
+ MIB.addImm(static_cast<unsigned>(ARMCC::AL)).addReg(0);
+ MIB.addExternalSymbol("__aeabi_read_tp", 0);
+ }
MIB->setMemRefs(MI.memoperands_begin(), MI.memoperands_end());
TransferImpOps(MI, MIB, MIB);
Modified: projects/clang400-import/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp
==============================================================================
--- projects/clang400-import/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp Thu Feb 23 19:21:47 2017 (r314176)
+++ projects/clang400-import/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp Thu Feb 23 19:25:29 2017 (r314177)
@@ -3027,17 +3027,20 @@ static SDValue promoteToConstantPool(con
return DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
}
+static bool isReadOnly(const GlobalValue *GV) {
+ if (const GlobalAlias *GA = dyn_cast<GlobalAlias>(GV))
+ GV = GA->getBaseObject();
+ return (isa<GlobalVariable>(GV) && cast<GlobalVariable>(GV)->isConstant()) ||
+ isa<Function>(GV);
+}
+
SDValue ARMTargetLowering::LowerGlobalAddressELF(SDValue Op,
SelectionDAG &DAG) const {
EVT PtrVT = getPointerTy(DAG.getDataLayout());
SDLoc dl(Op);
const GlobalValue *GV = cast<GlobalAddressSDNode>(Op)->getGlobal();
const TargetMachine &TM = getTargetMachine();
- if (const GlobalAlias *GA = dyn_cast<GlobalAlias>(GV))
- GV = GA->getBaseObject();
- bool IsRO =
- (isa<GlobalVariable>(GV) && cast<GlobalVariable>(GV)->isConstant()) ||
- isa<Function>(GV);
+ bool IsRO = isReadOnly(GV);
// promoteToConstantPool only if not generating XO text section
if (TM.shouldAssumeDSOLocal(*GV->getParent(), GV) && !Subtarget->genExecuteOnly())
Modified: projects/clang400-import/contrib/llvm/lib/Transforms/Scalar/LICM.cpp
==============================================================================
--- projects/clang400-import/contrib/llvm/lib/Transforms/Scalar/LICM.cpp Thu Feb 23 19:21:47 2017 (r314176)
+++ projects/clang400-import/contrib/llvm/lib/Transforms/Scalar/LICM.cpp Thu Feb 23 19:25:29 2017 (r314177)
@@ -1196,10 +1196,7 @@ LoopInvariantCodeMotion::collectAliasInf
auto mergeLoop = [&](Loop *L) {
// Loop over the body of this loop, looking for calls, invokes, and stores.
- // Because subloops have already been incorporated into AST, we skip blocks
- // in subloops.
for (BasicBlock *BB : L->blocks())
- if (LI->getLoopFor(BB) == L) // Ignore blocks in subloops.
CurAST->add(*BB); // Incorporate the specified basic block
};
Modified: projects/clang400-import/contrib/llvm/tools/clang/lib/CodeGen/CGOpenMPRuntime.cpp
==============================================================================
--- projects/clang400-import/contrib/llvm/tools/clang/lib/CodeGen/CGOpenMPRuntime.cpp Thu Feb 23 19:21:47 2017 (r314176)
+++ projects/clang400-import/contrib/llvm/tools/clang/lib/CodeGen/CGOpenMPRuntime.cpp Thu Feb 23 19:25:29 2017 (r314177)
@@ -4705,7 +4705,6 @@ void CGOpenMPRuntime::emitCancellationPo
auto *Result = CGF.EmitRuntimeCall(
createRuntimeFunction(OMPRTL__kmpc_cancellationpoint), Args);
// if (__kmpc_cancellationpoint()) {
- // __kmpc_cancel_barrier();
// exit from construct;
// }
auto *ExitBB = CGF.createBasicBlock(".cancel.exit");
@@ -4713,8 +4712,6 @@ void CGOpenMPRuntime::emitCancellationPo
auto *Cmp = CGF.Builder.CreateIsNotNull(Result);
CGF.Builder.CreateCondBr(Cmp, ExitBB, ContBB);
CGF.EmitBlock(ExitBB);
- // __kmpc_cancel_barrier();
- emitBarrierCall(CGF, Loc, OMPD_unknown, /*EmitChecks=*/false);
// exit from construct;
auto CancelDest =
CGF.getOMPCancelDestination(OMPRegionInfo->getDirectiveKind());
@@ -4743,7 +4740,6 @@ void CGOpenMPRuntime::emitCancelCall(Cod
auto *Result = CGF.EmitRuntimeCall(
RT.createRuntimeFunction(OMPRTL__kmpc_cancel), Args);
// if (__kmpc_cancel()) {
- // __kmpc_cancel_barrier();
// exit from construct;
// }
auto *ExitBB = CGF.createBasicBlock(".cancel.exit");
@@ -4751,8 +4747,6 @@ void CGOpenMPRuntime::emitCancelCall(Cod
auto *Cmp = CGF.Builder.CreateIsNotNull(Result);
CGF.Builder.CreateCondBr(Cmp, ExitBB, ContBB);
CGF.EmitBlock(ExitBB);
- // __kmpc_cancel_barrier();
- RT.emitBarrierCall(CGF, Loc, OMPD_unknown, /*EmitChecks=*/false);
// exit from construct;
auto CancelDest =
CGF.getOMPCancelDestination(OMPRegionInfo->getDirectiveKind());
Modified: projects/clang400-import/contrib/llvm/tools/clang/lib/Driver/Tools.cpp
==============================================================================
--- projects/clang400-import/contrib/llvm/tools/clang/lib/Driver/Tools.cpp Thu Feb 23 19:21:47 2017 (r314176)
+++ projects/clang400-import/contrib/llvm/tools/clang/lib/Driver/Tools.cpp Thu Feb 23 19:25:29 2017 (r314177)
@@ -8937,6 +8937,10 @@ void openbsd::Linker::ConstructJob(Compi
if (Args.hasArg(options::OPT_pg))
CmdArgs.push_back(
Args.MakeArgString(getToolChain().GetFilePath("gcrt0.o")));
+ else if (Args.hasArg(options::OPT_static) &&
+ !Args.hasArg(options::OPT_nopie))
+ CmdArgs.push_back(
+ Args.MakeArgString(getToolChain().GetFilePath("rcrt0.o")));
else
CmdArgs.push_back(
Args.MakeArgString(getToolChain().GetFilePath("crt0.o")));
Modified: projects/clang400-import/contrib/llvm/tools/clang/lib/Sema/SemaType.cpp
==============================================================================
--- projects/clang400-import/contrib/llvm/tools/clang/lib/Sema/SemaType.cpp Thu Feb 23 19:21:47 2017 (r314176)
+++ projects/clang400-import/contrib/llvm/tools/clang/lib/Sema/SemaType.cpp Thu Feb 23 19:25:29 2017 (r314177)
@@ -3154,7 +3154,7 @@ getCCForDeclaratorChunk(Sema &S, Declara
if (Attr->getKind() == AttributeList::AT_OpenCLKernel) {
llvm::Triple::ArchType arch = S.Context.getTargetInfo().getTriple().getArch();
if (arch == llvm::Triple::spir || arch == llvm::Triple::spir64 ||
- arch == llvm::Triple::amdgcn) {
+ arch == llvm::Triple::amdgcn || arch == llvm::Triple::r600) {
CC = CC_OpenCLKernel;
}
break;
Modified: projects/clang400-import/lib/clang/include/clang/Basic/Version.inc
==============================================================================
--- projects/clang400-import/lib/clang/include/clang/Basic/Version.inc Thu Feb 23 19:21:47 2017 (r314176)
+++ projects/clang400-import/lib/clang/include/clang/Basic/Version.inc Thu Feb 23 19:25:29 2017 (r314177)
@@ -8,4 +8,4 @@
#define CLANG_VENDOR "FreeBSD "
-#define SVN_REVISION "295380"
+#define SVN_REVISION "296002"
Modified: projects/clang400-import/lib/clang/include/lld/Config/Version.inc
==============================================================================
--- projects/clang400-import/lib/clang/include/lld/Config/Version.inc Thu Feb 23 19:21:47 2017 (r314176)
+++ projects/clang400-import/lib/clang/include/lld/Config/Version.inc Thu Feb 23 19:25:29 2017 (r314177)
@@ -4,5 +4,5 @@
#define LLD_VERSION_STRING "4.0.0"
#define LLD_VERSION_MAJOR 4
#define LLD_VERSION_MINOR 0
-#define LLD_REVISION_STRING "295380"
+#define LLD_REVISION_STRING "296002"
#define LLD_REPOSITORY_STRING "FreeBSD"
More information about the svn-src-projects
mailing list