svn commit: r309175 - in projects/clang391-import/contrib/llvm: include/llvm/Analysis include/llvm/ExecutionEngine include/llvm/IR lib/Analysis lib/CodeGen lib/Linker lib/Support/Unix lib/Target/AR...
Dimitry Andric
dim at FreeBSD.org
Sat Nov 26 01:02:57 UTC 2016
Author: dim
Date: Sat Nov 26 01:02:53 2016
New Revision: 309175
URL: https://svnweb.freebsd.org/changeset/base/309175
Log:
Update llvm, clang, lld and lldb to release_39 branch r287912.
Modified:
projects/clang391-import/contrib/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
projects/clang391-import/contrib/llvm/include/llvm/ExecutionEngine/RTDyldMemoryManager.h
projects/clang391-import/contrib/llvm/include/llvm/IR/Intrinsics.td
projects/clang391-import/contrib/llvm/include/llvm/IR/TypeFinder.h
projects/clang391-import/contrib/llvm/lib/Analysis/LoopAccessAnalysis.cpp
projects/clang391-import/contrib/llvm/lib/CodeGen/BranchFolding.cpp
projects/clang391-import/contrib/llvm/lib/Linker/IRMover.cpp
projects/clang391-import/contrib/llvm/lib/Support/Unix/Signals.inc
projects/clang391-import/contrib/llvm/lib/Target/ARM/ARMInstrThumb2.td
projects/clang391-import/contrib/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
projects/clang391-import/contrib/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
projects/clang391-import/contrib/llvm/lib/Target/PowerPC/PPCISelLowering.h
projects/clang391-import/contrib/llvm/lib/Target/PowerPC/PPCInstr64Bit.td
projects/clang391-import/contrib/llvm/lib/Target/PowerPC/PPCInstrInfo.td
projects/clang391-import/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp
projects/clang391-import/contrib/llvm/lib/Target/X86/X86InstrAVX512.td
projects/clang391-import/contrib/llvm/lib/Transforms/Scalar/JumpThreading.cpp
projects/clang391-import/contrib/llvm/tools/clang/include/clang/AST/DeclTemplate.h
projects/clang391-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticDriverKinds.td
projects/clang391-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td
projects/clang391-import/contrib/llvm/tools/clang/include/clang/Sema/Sema.h
projects/clang391-import/contrib/llvm/tools/clang/lib/Basic/Targets.cpp
projects/clang391-import/contrib/llvm/tools/clang/lib/Basic/Version.cpp
projects/clang391-import/contrib/llvm/tools/clang/lib/CodeGen/CGExpr.cpp
projects/clang391-import/contrib/llvm/tools/clang/lib/CodeGen/CGStmt.cpp
projects/clang391-import/contrib/llvm/tools/clang/lib/CodeGen/CGStmtOpenMP.cpp
projects/clang391-import/contrib/llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp
projects/clang391-import/contrib/llvm/tools/clang/lib/CodeGen/CodeGenFunction.h
projects/clang391-import/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp
projects/clang391-import/contrib/llvm/tools/clang/lib/Driver/Tools.cpp
projects/clang391-import/contrib/llvm/tools/clang/lib/Sema/Sema.cpp
projects/clang391-import/contrib/llvm/tools/clang/lib/Sema/SemaCXXScopeSpec.cpp
projects/clang391-import/contrib/llvm/tools/clang/lib/Sema/SemaDecl.cpp
projects/clang391-import/contrib/llvm/tools/clang/lib/Sema/SemaExpr.cpp
projects/clang391-import/contrib/llvm/tools/clang/lib/Sema/SemaExprCXX.cpp
projects/clang391-import/contrib/llvm/tools/clang/lib/Sema/SemaLambda.cpp
projects/clang391-import/contrib/llvm/tools/clang/lib/Sema/SemaOpenMP.cpp
projects/clang391-import/contrib/llvm/tools/clang/lib/Sema/SemaTemplate.cpp
projects/clang391-import/contrib/llvm/tools/clang/lib/Sema/SemaTemplateInstantiate.cpp
projects/clang391-import/contrib/llvm/tools/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
projects/clang391-import/contrib/llvm/tools/clang/lib/Serialization/ASTReaderDecl.cpp
projects/clang391-import/contrib/llvm/tools/lld/ELF/InputFiles.cpp
projects/clang391-import/contrib/llvm/tools/lldb/include/lldb/Core/ArchSpec.h
projects/clang391-import/contrib/llvm/tools/lldb/source/Core/ArchSpec.cpp
projects/clang391-import/contrib/llvm/tools/lldb/source/Core/RegisterValue.cpp
projects/clang391-import/contrib/llvm/tools/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
projects/clang391-import/contrib/llvm/tools/lldb/source/Plugins/Process/Utility/RegisterInfos_mips.h
projects/clang391-import/contrib/llvm/tools/lldb/source/Plugins/Process/Utility/RegisterInfos_mips64.h
projects/clang391-import/contrib/llvm/tools/lldb/source/Plugins/Process/Utility/lldb-mips-linux-register-enums.h
projects/clang391-import/contrib/llvm/tools/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
projects/clang391-import/contrib/llvm/tools/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
Directory Properties:
projects/clang391-import/contrib/llvm/ (props changed)
projects/clang391-import/contrib/llvm/tools/clang/ (props changed)
projects/clang391-import/contrib/llvm/tools/lld/ (props changed)
projects/clang391-import/contrib/llvm/tools/lldb/ (props changed)
Modified: projects/clang391-import/contrib/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
==============================================================================
--- projects/clang391-import/contrib/llvm/include/llvm/Analysis/LoopAccessAnalysis.h Sat Nov 26 00:59:01 2016 (r309174)
+++ projects/clang391-import/contrib/llvm/include/llvm/Analysis/LoopAccessAnalysis.h Sat Nov 26 01:02:53 2016 (r309175)
@@ -334,9 +334,11 @@ public:
struct PointerInfo {
/// Holds the pointer value that we need to check.
TrackingVH<Value> PointerValue;
- /// Holds the pointer value at the beginning of the loop.
+ /// Holds the smallest byte address accessed by the pointer throughout all
+ /// iterations of the loop.
const SCEV *Start;
- /// Holds the pointer value at the end of the loop.
+ /// Holds the largest byte address accessed by the pointer throughout all
+ /// iterations of the loop, plus 1.
const SCEV *End;
/// Holds the information if this pointer is used for writing to memory.
bool IsWritePtr;
Modified: projects/clang391-import/contrib/llvm/include/llvm/ExecutionEngine/RTDyldMemoryManager.h
==============================================================================
--- projects/clang391-import/contrib/llvm/include/llvm/ExecutionEngine/RTDyldMemoryManager.h Sat Nov 26 00:59:01 2016 (r309174)
+++ projects/clang391-import/contrib/llvm/include/llvm/ExecutionEngine/RTDyldMemoryManager.h Sat Nov 26 01:02:53 2016 (r309175)
@@ -72,7 +72,7 @@ public:
}
void deregisterEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size) override {
- registerEHFramesInProcess(Addr, Size);
+ deregisterEHFramesInProcess(Addr, Size);
}
/// This method returns the address of the specified function or variable in
Modified: projects/clang391-import/contrib/llvm/include/llvm/IR/Intrinsics.td
==============================================================================
--- projects/clang391-import/contrib/llvm/include/llvm/IR/Intrinsics.td Sat Nov 26 00:59:01 2016 (r309174)
+++ projects/clang391-import/contrib/llvm/include/llvm/IR/Intrinsics.td Sat Nov 26 01:02:53 2016 (r309175)
@@ -668,13 +668,12 @@ def int_masked_gather: Intrinsic<[llvm_a
[LLVMVectorOfPointersToElt<0>, llvm_i32_ty,
LLVMVectorSameWidth<0, llvm_i1_ty>,
LLVMMatchType<0>],
- [IntrReadMem, IntrArgMemOnly]>;
+ [IntrReadMem]>;
def int_masked_scatter: Intrinsic<[],
[llvm_anyvector_ty,
LLVMVectorOfPointersToElt<0>, llvm_i32_ty,
- LLVMVectorSameWidth<0, llvm_i1_ty>],
- [IntrArgMemOnly]>;
+ LLVMVectorSameWidth<0, llvm_i1_ty>]>;
// Test whether a pointer is associated with a type metadata identifier.
def int_type_test : Intrinsic<[llvm_i1_ty], [llvm_ptr_ty, llvm_metadata_ty],
Modified: projects/clang391-import/contrib/llvm/include/llvm/IR/TypeFinder.h
==============================================================================
--- projects/clang391-import/contrib/llvm/include/llvm/IR/TypeFinder.h Sat Nov 26 00:59:01 2016 (r309174)
+++ projects/clang391-import/contrib/llvm/include/llvm/IR/TypeFinder.h Sat Nov 26 01:02:53 2016 (r309175)
@@ -59,6 +59,8 @@ public:
StructType *&operator[](unsigned Idx) { return StructTypes[Idx]; }
+ DenseSet<const MDNode *> &getVisitedMetadata() { return VisitedMetadata; }
+
private:
/// incorporateType - This method adds the type to the list of used
/// structures if it's not in there already.
Modified: projects/clang391-import/contrib/llvm/lib/Analysis/LoopAccessAnalysis.cpp
==============================================================================
--- projects/clang391-import/contrib/llvm/lib/Analysis/LoopAccessAnalysis.cpp Sat Nov 26 00:59:01 2016 (r309174)
+++ projects/clang391-import/contrib/llvm/lib/Analysis/LoopAccessAnalysis.cpp Sat Nov 26 01:02:53 2016 (r309175)
@@ -148,6 +148,19 @@ const SCEV *llvm::replaceSymbolicStrideS
return OrigSCEV;
}
+/// Calculate Start and End points of memory access.
+/// Let's assume A is the first access and B is a memory access on N-th loop
+/// iteration. Then B is calculated as:
+/// B = A + Step*N .
+/// Step value may be positive or negative.
+/// N is a calculated back-edge taken count:
+/// N = (TripCount > 0) ? RoundDown(TripCount -1 , VF) : 0
+/// Start and End points are calculated in the following way:
+/// Start = UMIN(A, B) ; End = UMAX(A, B) + SizeOfElt,
+/// where SizeOfElt is the size of single memory access in bytes.
+///
+/// There is no conflict when the intervals are disjoint:
+/// NoConflict = (P2.Start >= P1.End) || (P1.Start >= P2.End)
void RuntimePointerChecking::insert(Loop *Lp, Value *Ptr, bool WritePtr,
unsigned DepSetId, unsigned ASId,
const ValueToValueMap &Strides,
@@ -176,12 +189,17 @@ void RuntimePointerChecking::insert(Loop
if (CStep->getValue()->isNegative())
std::swap(ScStart, ScEnd);
} else {
- // Fallback case: the step is not constant, but the we can still
+ // Fallback case: the step is not constant, but we can still
// get the upper and lower bounds of the interval by using min/max
// expressions.
ScStart = SE->getUMinExpr(ScStart, ScEnd);
ScEnd = SE->getUMaxExpr(AR->getStart(), ScEnd);
}
+ // Add the size of the pointed element to ScEnd.
+ unsigned EltSize =
+ Ptr->getType()->getPointerElementType()->getScalarSizeInBits() / 8;
+ const SCEV *EltSizeSCEV = SE->getConstant(ScEnd->getType(), EltSize);
+ ScEnd = SE->getAddExpr(ScEnd, EltSizeSCEV);
}
Pointers.emplace_back(Ptr, ScStart, ScEnd, WritePtr, DepSetId, ASId, Sc);
@@ -1863,9 +1881,17 @@ std::pair<Instruction *, Instruction *>
Value *End0 = ChkBuilder.CreateBitCast(A.End, PtrArithTy1, "bc");
Value *End1 = ChkBuilder.CreateBitCast(B.End, PtrArithTy0, "bc");
- Value *Cmp0 = ChkBuilder.CreateICmpULE(Start0, End1, "bound0");
+ // [A|B].Start points to the first accessed byte under base [A|B].
+ // [A|B].End points to the last accessed byte, plus one.
+ // There is no conflict when the intervals are disjoint:
+ // NoConflict = (B.Start >= A.End) || (A.Start >= B.End)
+ //
+ // bound0 = (B.Start < A.End)
+ // bound1 = (A.Start < B.End)
+ // IsConflict = bound0 & bound1
+ Value *Cmp0 = ChkBuilder.CreateICmpULT(Start0, End1, "bound0");
FirstInst = getFirstInst(FirstInst, Cmp0, Loc);
- Value *Cmp1 = ChkBuilder.CreateICmpULE(Start1, End0, "bound1");
+ Value *Cmp1 = ChkBuilder.CreateICmpULT(Start1, End0, "bound1");
FirstInst = getFirstInst(FirstInst, Cmp1, Loc);
Value *IsConflict = ChkBuilder.CreateAnd(Cmp0, Cmp1, "found.conflict");
FirstInst = getFirstInst(FirstInst, IsConflict, Loc);
Modified: projects/clang391-import/contrib/llvm/lib/CodeGen/BranchFolding.cpp
==============================================================================
--- projects/clang391-import/contrib/llvm/lib/CodeGen/BranchFolding.cpp Sat Nov 26 00:59:01 2016 (r309174)
+++ projects/clang391-import/contrib/llvm/lib/CodeGen/BranchFolding.cpp Sat Nov 26 01:02:53 2016 (r309175)
@@ -776,9 +776,8 @@ bool BranchFolder::CreateCommonTailOnlyB
}
static void
-mergeMMOsFromMemoryOperations(MachineBasicBlock::iterator MBBIStartPos,
- MachineBasicBlock &MBBCommon) {
- // Merge MMOs from memory operations in the common block.
+mergeOperations(MachineBasicBlock::iterator MBBIStartPos,
+ MachineBasicBlock &MBBCommon) {
MachineBasicBlock *MBB = MBBIStartPos->getParent();
// Note CommonTailLen does not necessarily matches the size of
// the common BB nor all its instructions because of debug
@@ -808,8 +807,18 @@ mergeMMOsFromMemoryOperations(MachineBas
"Reached BB end within common tail length!");
assert(MBBICommon->isIdenticalTo(*MBBI) && "Expected matching MIIs!");
+ // Merge MMOs from memory operations in the common block.
if (MBBICommon->mayLoad() || MBBICommon->mayStore())
MBBICommon->setMemRefs(MBBICommon->mergeMemRefsWith(*MBBI));
+ // Drop undef flags if they aren't present in all merged instructions.
+ for (unsigned I = 0, E = MBBICommon->getNumOperands(); I != E; ++I) {
+ MachineOperand &MO = MBBICommon->getOperand(I);
+ if (MO.isReg() && MO.isUndef()) {
+ const MachineOperand &OtherMO = MBBI->getOperand(I);
+ if (!OtherMO.isUndef())
+ MO.setIsUndef(false);
+ }
+ }
++MBBI;
++MBBICommon;
@@ -928,8 +937,8 @@ bool BranchFolder::TryTailMergeBlocks(Ma
continue;
DEBUG(dbgs() << "BB#" << SameTails[i].getBlock()->getNumber()
<< (i == e-1 ? "" : ", "));
- // Merge MMOs from memory operations as needed.
- mergeMMOsFromMemoryOperations(SameTails[i].getTailStartPos(), *MBB);
+ // Merge operations (MMOs, undef flags)
+ mergeOperations(SameTails[i].getTailStartPos(), *MBB);
// Hack the end off BB i, making it jump to BB commonTailIndex instead.
ReplaceTailWithBranchTo(SameTails[i].getTailStartPos(), MBB);
// BB i is no longer a predecessor of SuccBB; remove it from the worklist.
Modified: projects/clang391-import/contrib/llvm/lib/Linker/IRMover.cpp
==============================================================================
--- projects/clang391-import/contrib/llvm/lib/Linker/IRMover.cpp Sat Nov 26 00:59:01 2016 (r309174)
+++ projects/clang391-import/contrib/llvm/lib/Linker/IRMover.cpp Sat Nov 26 01:02:53 2016 (r309175)
@@ -694,6 +694,14 @@ void IRLinker::computeTypeMapping() {
if (!ST->hasName())
continue;
+ if (TypeMap.DstStructTypesSet.hasType(ST)) {
+ // This is actually a type from the destination module.
+ // getIdentifiedStructTypes() can have found it by walking debug info
+ // metadata nodes, some of which get linked by name when ODR Type Uniquing
+ // is enabled on the Context, from the source to the destination module.
+ continue;
+ }
+
// Check to see if there is a dot in the name followed by a digit.
size_t DotPos = ST->getName().rfind('.');
if (DotPos == 0 || DotPos == StringRef::npos ||
@@ -1336,13 +1344,19 @@ bool IRMover::IdentifiedStructTypeSet::h
IRMover::IRMover(Module &M) : Composite(M) {
TypeFinder StructTypes;
- StructTypes.run(M, true);
+ StructTypes.run(M, /* OnlyNamed */ false);
for (StructType *Ty : StructTypes) {
if (Ty->isOpaque())
IdentifiedStructTypes.addOpaque(Ty);
else
IdentifiedStructTypes.addNonOpaque(Ty);
}
+ // Self-map metadatas in the destination module. This is needed when
+ // DebugTypeODRUniquing is enabled on the LLVMContext, since metadata in the
+ // destination module may be reached from the source module.
+ for (auto *MD : StructTypes.getVisitedMetadata()) {
+ SharedMDs[MD].reset(const_cast<MDNode *>(MD));
+ }
}
Error IRMover::move(
Modified: projects/clang391-import/contrib/llvm/lib/Support/Unix/Signals.inc
==============================================================================
--- projects/clang391-import/contrib/llvm/lib/Support/Unix/Signals.inc Sat Nov 26 00:59:01 2016 (r309174)
+++ projects/clang391-import/contrib/llvm/lib/Support/Unix/Signals.inc Sat Nov 26 01:02:53 2016 (r309175)
@@ -412,7 +412,7 @@ void llvm::sys::PrintStackTrace(raw_ostr
if (printSymbolizedStackTrace(Argv0, StackTrace, depth, OS))
return;
-#if HAVE_DLFCN_H && __GNUG__
+#if HAVE_DLFCN_H && __GNUG__ && !defined(__CYGWIN__)
int width = 0;
for (int i = 0; i < depth; ++i) {
Dl_info dlinfo;
Modified: projects/clang391-import/contrib/llvm/lib/Target/ARM/ARMInstrThumb2.td
==============================================================================
--- projects/clang391-import/contrib/llvm/lib/Target/ARM/ARMInstrThumb2.td Sat Nov 26 00:59:01 2016 (r309174)
+++ projects/clang391-import/contrib/llvm/lib/Target/ARM/ARMInstrThumb2.td Sat Nov 26 01:02:53 2016 (r309175)
@@ -4819,6 +4819,10 @@ def : t2InstAlias<"add${p} $Rd, pc, $imm
def t2LDRConstPool
: t2AsmPseudo<"ldr${p} $Rt, $immediate",
(ins GPRnopc:$Rt, const_pool_asm_imm:$immediate, pred:$p)>;
+// Version w/ the .w suffix.
+def : t2InstAlias<"ldr${p}.w $Rt, $immediate",
+ (t2LDRConstPool GPRnopc:$Rt,
+ const_pool_asm_imm:$immediate, pred:$p)>;
// PLD/PLDW/PLI with alternate literal form.
def : t2InstAlias<"pld${p} $addr",
Modified: projects/clang391-import/contrib/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
==============================================================================
--- projects/clang391-import/contrib/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Sat Nov 26 00:59:01 2016 (r309174)
+++ projects/clang391-import/contrib/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Sat Nov 26 01:02:53 2016 (r309175)
@@ -6933,6 +6933,9 @@ bool ARMAsmParser::processInstruction(MC
else if (Inst.getOpcode() == ARM::t2LDRConstPool)
TmpInst.setOpcode(ARM::t2LDRpci);
const ARMOperand &PoolOperand =
+ (static_cast<ARMOperand &>(*Operands[2]).isToken() &&
+ static_cast<ARMOperand &>(*Operands[2]).getToken() == ".w") ?
+ static_cast<ARMOperand &>(*Operands[4]) :
static_cast<ARMOperand &>(*Operands[3]);
const MCExpr *SubExprVal = PoolOperand.getConstantPoolImm();
// If SubExprVal is a constant we may be able to use a MOV
Modified: projects/clang391-import/contrib/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
==============================================================================
--- projects/clang391-import/contrib/llvm/lib/Target/PowerPC/PPCISelLowering.cpp Sat Nov 26 00:59:01 2016 (r309174)
+++ projects/clang391-import/contrib/llvm/lib/Target/PowerPC/PPCISelLowering.cpp Sat Nov 26 01:02:53 2016 (r309175)
@@ -667,9 +667,10 @@ PPCTargetLowering::PPCTargetLowering(con
addRegisterClass(MVT::v2i64, &PPC::VRRCRegClass);
addRegisterClass(MVT::v1i128, &PPC::VRRCRegClass);
}
+
if (Subtarget.hasP9Vector()) {
- setOperationAction(ISD::INSERT_VECTOR_ELT, MVT::v4i32, Legal);
- setOperationAction(ISD::INSERT_VECTOR_ELT, MVT::v4f32, Legal);
+ setOperationAction(ISD::INSERT_VECTOR_ELT, MVT::v4i32, Custom);
+ setOperationAction(ISD::INSERT_VECTOR_ELT, MVT::v4f32, Custom);
}
}
@@ -7868,6 +7869,17 @@ SDValue PPCTargetLowering::LowerSCALAR_T
return DAG.getLoad(Op.getValueType(), dl, Store, FIdx, MachinePointerInfo());
}
+SDValue PPCTargetLowering::LowerINSERT_VECTOR_ELT(SDValue Op,
+ SelectionDAG &DAG) const {
+ assert(Op.getOpcode() == ISD::INSERT_VECTOR_ELT &&
+ "Should only be called for ISD::INSERT_VECTOR_ELT");
+ ConstantSDNode *C = dyn_cast<ConstantSDNode>(Op.getOperand(2));
+ // We have legal lowering for constant indices but not for variable ones.
+ if (C)
+ return Op;
+ return SDValue();
+}
+
SDValue PPCTargetLowering::LowerEXTRACT_VECTOR_ELT(SDValue Op,
SelectionDAG &DAG) const {
SDLoc dl(Op);
@@ -8273,6 +8285,7 @@ SDValue PPCTargetLowering::LowerOperatio
case ISD::SCALAR_TO_VECTOR: return LowerSCALAR_TO_VECTOR(Op, DAG);
case ISD::SIGN_EXTEND_INREG: return LowerSIGN_EXTEND_INREG(Op, DAG);
case ISD::EXTRACT_VECTOR_ELT: return LowerEXTRACT_VECTOR_ELT(Op, DAG);
+ case ISD::INSERT_VECTOR_ELT: return LowerINSERT_VECTOR_ELT(Op, DAG);
case ISD::MUL: return LowerMUL(Op, DAG);
// For counter-based loop handling.
@@ -8397,7 +8410,9 @@ Instruction* PPCTargetLowering::emitTrai
MachineBasicBlock *
PPCTargetLowering::EmitAtomicBinary(MachineInstr &MI, MachineBasicBlock *BB,
unsigned AtomicSize,
- unsigned BinOpcode) const {
+ unsigned BinOpcode,
+ unsigned CmpOpcode,
+ unsigned CmpPred) const {
// This also handles ATOMIC_SWAP, indicated by BinOpcode==0.
const TargetInstrInfo *TII = Subtarget.getInstrInfo();
@@ -8437,8 +8452,12 @@ PPCTargetLowering::EmitAtomicBinary(Mach
DebugLoc dl = MI.getDebugLoc();
MachineBasicBlock *loopMBB = F->CreateMachineBasicBlock(LLVM_BB);
+ MachineBasicBlock *loop2MBB =
+ CmpOpcode ? F->CreateMachineBasicBlock(LLVM_BB) : nullptr;
MachineBasicBlock *exitMBB = F->CreateMachineBasicBlock(LLVM_BB);
F->insert(It, loopMBB);
+ if (CmpOpcode)
+ F->insert(It, loop2MBB);
F->insert(It, exitMBB);
exitMBB->splice(exitMBB->begin(), BB,
std::next(MachineBasicBlock::iterator(MI)), BB->end());
@@ -8460,11 +8479,40 @@ PPCTargetLowering::EmitAtomicBinary(Mach
// st[wd]cx. r0, ptr
// bne- loopMBB
// fallthrough --> exitMBB
+
+ // For max/min...
+ // loopMBB:
+ // l[wd]arx dest, ptr
+ // cmpl?[wd] incr, dest
+ // bgt exitMBB
+ // loop2MBB:
+ // st[wd]cx. dest, ptr
+ // bne- loopMBB
+ // fallthrough --> exitMBB
+
BB = loopMBB;
BuildMI(BB, dl, TII->get(LoadMnemonic), dest)
.addReg(ptrA).addReg(ptrB);
if (BinOpcode)
BuildMI(BB, dl, TII->get(BinOpcode), TmpReg).addReg(incr).addReg(dest);
+ if (CmpOpcode) {
+ // Signed comparisons of byte or halfword values must be sign-extended.
+ if (CmpOpcode == PPC::CMPW && AtomicSize < 4) {
+ unsigned ExtReg = RegInfo.createVirtualRegister(&PPC::GPRCRegClass);
+ BuildMI(BB, dl, TII->get(AtomicSize == 1 ? PPC::EXTSB : PPC::EXTSH),
+ ExtReg).addReg(dest);
+ BuildMI(BB, dl, TII->get(CmpOpcode), PPC::CR0)
+ .addReg(incr).addReg(ExtReg);
+ } else
+ BuildMI(BB, dl, TII->get(CmpOpcode), PPC::CR0)
+ .addReg(incr).addReg(dest);
+
+ BuildMI(BB, dl, TII->get(PPC::BCC))
+ .addImm(CmpPred).addReg(PPC::CR0).addMBB(exitMBB);
+ BB->addSuccessor(loop2MBB);
+ BB->addSuccessor(exitMBB);
+ BB = loop2MBB;
+ }
BuildMI(BB, dl, TII->get(StoreMnemonic))
.addReg(TmpReg).addReg(ptrA).addReg(ptrB);
BuildMI(BB, dl, TII->get(PPC::BCC))
@@ -8482,10 +8530,13 @@ MachineBasicBlock *
PPCTargetLowering::EmitPartwordAtomicBinary(MachineInstr &MI,
MachineBasicBlock *BB,
bool is8bit, // operation
- unsigned BinOpcode) const {
+ unsigned BinOpcode,
+ unsigned CmpOpcode,
+ unsigned CmpPred) const {
// If we support part-word atomic mnemonics, just use them
if (Subtarget.hasPartwordAtomics())
- return EmitAtomicBinary(MI, BB, is8bit ? 1 : 2, BinOpcode);
+ return EmitAtomicBinary(MI, BB, is8bit ? 1 : 2, BinOpcode,
+ CmpOpcode, CmpPred);
// This also handles ATOMIC_SWAP, indicated by BinOpcode==0.
const TargetInstrInfo *TII = Subtarget.getInstrInfo();
@@ -8507,8 +8558,12 @@ PPCTargetLowering::EmitPartwordAtomicBin
DebugLoc dl = MI.getDebugLoc();
MachineBasicBlock *loopMBB = F->CreateMachineBasicBlock(LLVM_BB);
+ MachineBasicBlock *loop2MBB =
+ CmpOpcode ? F->CreateMachineBasicBlock(LLVM_BB) : nullptr;
MachineBasicBlock *exitMBB = F->CreateMachineBasicBlock(LLVM_BB);
F->insert(It, loopMBB);
+ if (CmpOpcode)
+ F->insert(It, loop2MBB);
F->insert(It, exitMBB);
exitMBB->splice(exitMBB->begin(), BB,
std::next(MachineBasicBlock::iterator(MI)), BB->end());
@@ -8593,6 +8648,32 @@ PPCTargetLowering::EmitPartwordAtomicBin
.addReg(TmpDestReg).addReg(MaskReg);
BuildMI(BB, dl, TII->get(is64bit ? PPC::AND8 : PPC::AND), Tmp3Reg)
.addReg(TmpReg).addReg(MaskReg);
+ if (CmpOpcode) {
+ // For unsigned comparisons, we can directly compare the shifted values.
+ // For signed comparisons we shift and sign extend.
+ unsigned SReg = RegInfo.createVirtualRegister(RC);
+ BuildMI(BB, dl, TII->get(is64bit ? PPC::AND8 : PPC::AND), SReg)
+ .addReg(TmpDestReg).addReg(MaskReg);
+ unsigned ValueReg = SReg;
+ unsigned CmpReg = Incr2Reg;
+ if (CmpOpcode == PPC::CMPW) {
+ ValueReg = RegInfo.createVirtualRegister(RC);
+ BuildMI(BB, dl, TII->get(PPC::SRW), ValueReg)
+ .addReg(SReg).addReg(ShiftReg);
+ unsigned ValueSReg = RegInfo.createVirtualRegister(RC);
+ BuildMI(BB, dl, TII->get(is8bit ? PPC::EXTSB : PPC::EXTSH), ValueSReg)
+ .addReg(ValueReg);
+ ValueReg = ValueSReg;
+ CmpReg = incr;
+ }
+ BuildMI(BB, dl, TII->get(CmpOpcode), PPC::CR0)
+ .addReg(CmpReg).addReg(ValueReg);
+ BuildMI(BB, dl, TII->get(PPC::BCC))
+ .addImm(CmpPred).addReg(PPC::CR0).addMBB(exitMBB);
+ BB->addSuccessor(loop2MBB);
+ BB->addSuccessor(exitMBB);
+ BB = loop2MBB;
+ }
BuildMI(BB, dl, TII->get(is64bit ? PPC::OR8 : PPC::OR), Tmp4Reg)
.addReg(Tmp3Reg).addReg(Tmp2Reg);
BuildMI(BB, dl, TII->get(PPC::STWCX))
@@ -9099,6 +9180,42 @@ PPCTargetLowering::EmitInstrWithCustomIn
else if (MI.getOpcode() == PPC::ATOMIC_LOAD_SUB_I64)
BB = EmitAtomicBinary(MI, BB, 8, PPC::SUBF8);
+ else if (MI.getOpcode() == PPC::ATOMIC_LOAD_MIN_I8)
+ BB = EmitPartwordAtomicBinary(MI, BB, true, 0, PPC::CMPW, PPC::PRED_GE);
+ else if (MI.getOpcode() == PPC::ATOMIC_LOAD_MIN_I16)
+ BB = EmitPartwordAtomicBinary(MI, BB, false, 0, PPC::CMPW, PPC::PRED_GE);
+ else if (MI.getOpcode() == PPC::ATOMIC_LOAD_MIN_I32)
+ BB = EmitAtomicBinary(MI, BB, 4, 0, PPC::CMPW, PPC::PRED_GE);
+ else if (MI.getOpcode() == PPC::ATOMIC_LOAD_MIN_I64)
+ BB = EmitAtomicBinary(MI, BB, 8, 0, PPC::CMPD, PPC::PRED_GE);
+
+ else if (MI.getOpcode() == PPC::ATOMIC_LOAD_MAX_I8)
+ BB = EmitPartwordAtomicBinary(MI, BB, true, 0, PPC::CMPW, PPC::PRED_LE);
+ else if (MI.getOpcode() == PPC::ATOMIC_LOAD_MAX_I16)
+ BB = EmitPartwordAtomicBinary(MI, BB, false, 0, PPC::CMPW, PPC::PRED_LE);
+ else if (MI.getOpcode() == PPC::ATOMIC_LOAD_MAX_I32)
+ BB = EmitAtomicBinary(MI, BB, 4, 0, PPC::CMPW, PPC::PRED_LE);
+ else if (MI.getOpcode() == PPC::ATOMIC_LOAD_MAX_I64)
+ BB = EmitAtomicBinary(MI, BB, 8, 0, PPC::CMPD, PPC::PRED_LE);
+
+ else if (MI.getOpcode() == PPC::ATOMIC_LOAD_UMIN_I8)
+ BB = EmitPartwordAtomicBinary(MI, BB, true, 0, PPC::CMPLW, PPC::PRED_GE);
+ else if (MI.getOpcode() == PPC::ATOMIC_LOAD_UMIN_I16)
+ BB = EmitPartwordAtomicBinary(MI, BB, false, 0, PPC::CMPLW, PPC::PRED_GE);
+ else if (MI.getOpcode() == PPC::ATOMIC_LOAD_UMIN_I32)
+ BB = EmitAtomicBinary(MI, BB, 4, 0, PPC::CMPLW, PPC::PRED_GE);
+ else if (MI.getOpcode() == PPC::ATOMIC_LOAD_UMIN_I64)
+ BB = EmitAtomicBinary(MI, BB, 8, 0, PPC::CMPLD, PPC::PRED_GE);
+
+ else if (MI.getOpcode() == PPC::ATOMIC_LOAD_UMAX_I8)
+ BB = EmitPartwordAtomicBinary(MI, BB, true, 0, PPC::CMPLW, PPC::PRED_LE);
+ else if (MI.getOpcode() == PPC::ATOMIC_LOAD_UMAX_I16)
+ BB = EmitPartwordAtomicBinary(MI, BB, false, 0, PPC::CMPLW, PPC::PRED_LE);
+ else if (MI.getOpcode() == PPC::ATOMIC_LOAD_UMAX_I32)
+ BB = EmitAtomicBinary(MI, BB, 4, 0, PPC::CMPLW, PPC::PRED_LE);
+ else if (MI.getOpcode() == PPC::ATOMIC_LOAD_UMAX_I64)
+ BB = EmitAtomicBinary(MI, BB, 8, 0, PPC::CMPLD, PPC::PRED_LE);
+
else if (MI.getOpcode() == PPC::ATOMIC_SWAP_I8)
BB = EmitPartwordAtomicBinary(MI, BB, true, 0);
else if (MI.getOpcode() == PPC::ATOMIC_SWAP_I16)
Modified: projects/clang391-import/contrib/llvm/lib/Target/PowerPC/PPCISelLowering.h
==============================================================================
--- projects/clang391-import/contrib/llvm/lib/Target/PowerPC/PPCISelLowering.h Sat Nov 26 00:59:01 2016 (r309174)
+++ projects/clang391-import/contrib/llvm/lib/Target/PowerPC/PPCISelLowering.h Sat Nov 26 01:02:53 2016 (r309175)
@@ -585,11 +585,15 @@ namespace llvm {
MachineBasicBlock *EmitAtomicBinary(MachineInstr &MI,
MachineBasicBlock *MBB,
unsigned AtomicSize,
- unsigned BinOpcode) const;
+ unsigned BinOpcode,
+ unsigned CmpOpcode = 0,
+ unsigned CmpPred = 0) const;
MachineBasicBlock *EmitPartwordAtomicBinary(MachineInstr &MI,
MachineBasicBlock *MBB,
bool is8bit,
- unsigned Opcode) const;
+ unsigned Opcode,
+ unsigned CmpOpcode = 0,
+ unsigned CmpPred = 0) const;
MachineBasicBlock *emitEHSjLjSetJmp(MachineInstr &MI,
MachineBasicBlock *MBB) const;
@@ -825,6 +829,7 @@ namespace llvm {
SDValue LowerSRA_PARTS(SDValue Op, SelectionDAG &DAG) const;
SDValue LowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) const;
SDValue LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) const;
+ SDValue LowerINSERT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const;
SDValue LowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const;
SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) const;
SDValue LowerSCALAR_TO_VECTOR(SDValue Op, SelectionDAG &DAG) const;
Modified: projects/clang391-import/contrib/llvm/lib/Target/PowerPC/PPCInstr64Bit.td
==============================================================================
--- projects/clang391-import/contrib/llvm/lib/Target/PowerPC/PPCInstr64Bit.td Sat Nov 26 00:59:01 2016 (r309174)
+++ projects/clang391-import/contrib/llvm/lib/Target/PowerPC/PPCInstr64Bit.td Sat Nov 26 01:02:53 2016 (r309175)
@@ -224,6 +224,18 @@ let usesCustomInserter = 1 in {
def ATOMIC_LOAD_NAND_I64 : Pseudo<
(outs g8rc:$dst), (ins memrr:$ptr, g8rc:$incr), "#ATOMIC_LOAD_NAND_I64",
[(set i64:$dst, (atomic_load_nand_64 xoaddr:$ptr, i64:$incr))]>;
+ def ATOMIC_LOAD_MIN_I64 : Pseudo<
+ (outs g8rc:$dst), (ins memrr:$ptr, g8rc:$incr), "#ATOMIC_LOAD_MIN_I64",
+ [(set i64:$dst, (atomic_load_min_64 xoaddr:$ptr, i64:$incr))]>;
+ def ATOMIC_LOAD_MAX_I64 : Pseudo<
+ (outs g8rc:$dst), (ins memrr:$ptr, g8rc:$incr), "#ATOMIC_LOAD_MAX_I64",
+ [(set i64:$dst, (atomic_load_max_64 xoaddr:$ptr, i64:$incr))]>;
+ def ATOMIC_LOAD_UMIN_I64 : Pseudo<
+ (outs g8rc:$dst), (ins memrr:$ptr, g8rc:$incr), "#ATOMIC_LOAD_UMIN_I64",
+ [(set i64:$dst, (atomic_load_umin_64 xoaddr:$ptr, i64:$incr))]>;
+ def ATOMIC_LOAD_UMAX_I64 : Pseudo<
+ (outs g8rc:$dst), (ins memrr:$ptr, g8rc:$incr), "#ATOMIC_LOAD_UMAX_I64",
+ [(set i64:$dst, (atomic_load_umax_64 xoaddr:$ptr, i64:$incr))]>;
def ATOMIC_CMP_SWAP_I64 : Pseudo<
(outs g8rc:$dst), (ins memrr:$ptr, g8rc:$old, g8rc:$new), "#ATOMIC_CMP_SWAP_I64",
Modified: projects/clang391-import/contrib/llvm/lib/Target/PowerPC/PPCInstrInfo.td
==============================================================================
--- projects/clang391-import/contrib/llvm/lib/Target/PowerPC/PPCInstrInfo.td Sat Nov 26 00:59:01 2016 (r309174)
+++ projects/clang391-import/contrib/llvm/lib/Target/PowerPC/PPCInstrInfo.td Sat Nov 26 01:02:53 2016 (r309175)
@@ -1509,6 +1509,18 @@ let usesCustomInserter = 1 in {
def ATOMIC_LOAD_NAND_I8 : Pseudo<
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_NAND_I8",
[(set i32:$dst, (atomic_load_nand_8 xoaddr:$ptr, i32:$incr))]>;
+ def ATOMIC_LOAD_MIN_I8 : Pseudo<
+ (outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_MIN_I8",
+ [(set i32:$dst, (atomic_load_min_8 xoaddr:$ptr, i32:$incr))]>;
+ def ATOMIC_LOAD_MAX_I8 : Pseudo<
+ (outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_MAX_I8",
+ [(set i32:$dst, (atomic_load_max_8 xoaddr:$ptr, i32:$incr))]>;
+ def ATOMIC_LOAD_UMIN_I8 : Pseudo<
+ (outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_UMIN_I8",
+ [(set i32:$dst, (atomic_load_umin_8 xoaddr:$ptr, i32:$incr))]>;
+ def ATOMIC_LOAD_UMAX_I8 : Pseudo<
+ (outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_UMAX_I8",
+ [(set i32:$dst, (atomic_load_umax_8 xoaddr:$ptr, i32:$incr))]>;
def ATOMIC_LOAD_ADD_I16 : Pseudo<
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_ADD_I16",
[(set i32:$dst, (atomic_load_add_16 xoaddr:$ptr, i32:$incr))]>;
@@ -1527,6 +1539,18 @@ let usesCustomInserter = 1 in {
def ATOMIC_LOAD_NAND_I16 : Pseudo<
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_NAND_I16",
[(set i32:$dst, (atomic_load_nand_16 xoaddr:$ptr, i32:$incr))]>;
+ def ATOMIC_LOAD_MIN_I16 : Pseudo<
+ (outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_MIN_I16",
+ [(set i32:$dst, (atomic_load_min_16 xoaddr:$ptr, i32:$incr))]>;
+ def ATOMIC_LOAD_MAX_I16 : Pseudo<
+ (outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_MAX_I16",
+ [(set i32:$dst, (atomic_load_max_16 xoaddr:$ptr, i32:$incr))]>;
+ def ATOMIC_LOAD_UMIN_I16 : Pseudo<
+ (outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_UMIN_I16",
+ [(set i32:$dst, (atomic_load_umin_16 xoaddr:$ptr, i32:$incr))]>;
+ def ATOMIC_LOAD_UMAX_I16 : Pseudo<
+ (outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_UMAX_I16",
+ [(set i32:$dst, (atomic_load_umax_16 xoaddr:$ptr, i32:$incr))]>;
def ATOMIC_LOAD_ADD_I32 : Pseudo<
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_ADD_I32",
[(set i32:$dst, (atomic_load_add_32 xoaddr:$ptr, i32:$incr))]>;
@@ -1545,6 +1569,18 @@ let usesCustomInserter = 1 in {
def ATOMIC_LOAD_NAND_I32 : Pseudo<
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_NAND_I32",
[(set i32:$dst, (atomic_load_nand_32 xoaddr:$ptr, i32:$incr))]>;
+ def ATOMIC_LOAD_MIN_I32 : Pseudo<
+ (outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_MIN_I32",
+ [(set i32:$dst, (atomic_load_min_32 xoaddr:$ptr, i32:$incr))]>;
+ def ATOMIC_LOAD_MAX_I32 : Pseudo<
+ (outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_MAX_I32",
+ [(set i32:$dst, (atomic_load_max_32 xoaddr:$ptr, i32:$incr))]>;
+ def ATOMIC_LOAD_UMIN_I32 : Pseudo<
+ (outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_UMIN_I32",
+ [(set i32:$dst, (atomic_load_umin_32 xoaddr:$ptr, i32:$incr))]>;
+ def ATOMIC_LOAD_UMAX_I32 : Pseudo<
+ (outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_UMAX_I32",
+ [(set i32:$dst, (atomic_load_umax_32 xoaddr:$ptr, i32:$incr))]>;
def ATOMIC_CMP_SWAP_I8 : Pseudo<
(outs gprc:$dst), (ins memrr:$ptr, gprc:$old, gprc:$new), "#ATOMIC_CMP_SWAP_I8",
Modified: projects/clang391-import/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp
==============================================================================
--- projects/clang391-import/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Sat Nov 26 00:59:01 2016 (r309174)
+++ projects/clang391-import/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Sat Nov 26 01:02:53 2016 (r309175)
@@ -8656,6 +8656,17 @@ static SDValue lowerVectorShuffleAsBroad
V = DAG.getLoad(SVT, DL, Ld->getChain(), NewAddr,
DAG.getMachineFunction().getMachineMemOperand(
Ld->getMemOperand(), Offset, SVT.getStoreSize()));
+
+ // Make sure the newly-created LOAD is in the same position as Ld in
+ // terms of dependency. We create a TokenFactor for Ld and V,
+ // and update uses of Ld's output chain to use the TokenFactor.
+ if (Ld->hasAnyUseOfValue(1)) {
+ SDValue NewChain = DAG.getNode(ISD::TokenFactor, DL, MVT::Other,
+ SDValue(Ld, 1), SDValue(V.getNode(), 1));
+ DAG.ReplaceAllUsesOfValueWith(SDValue(Ld, 1), NewChain);
+ DAG.UpdateNodeOperands(NewChain.getNode(), SDValue(Ld, 1),
+ SDValue(V.getNode(), 1));
+ }
} else if (!BroadcastFromReg) {
// We can't broadcast from a vector register.
return SDValue();
Modified: projects/clang391-import/contrib/llvm/lib/Target/X86/X86InstrAVX512.td
==============================================================================
--- projects/clang391-import/contrib/llvm/lib/Target/X86/X86InstrAVX512.td Sat Nov 26 00:59:01 2016 (r309174)
+++ projects/clang391-import/contrib/llvm/lib/Target/X86/X86InstrAVX512.td Sat Nov 26 01:02:53 2016 (r309175)
@@ -2124,7 +2124,7 @@ let Predicates = [HasAVX512] in {
(COPY_TO_REGCLASS (i16 (EXTRACT_SUBREG $src, sub_16bit)), VK1)>;
def : Pat<(i1 (trunc (i8 GR8:$src))),
- (COPY_TO_REGCLASS (i16 (SUBREG_TO_REG (i64 0), (AND8ri8 $src, (i8 1)),
+ (COPY_TO_REGCLASS (i16 (SUBREG_TO_REG (i64 0), (AND8ri $src, (i8 1)),
sub_8bit)), VK1)>;
def : Pat<(i1 (trunc (i8 (assertzext_i1 GR8:$src)))),
Modified: projects/clang391-import/contrib/llvm/lib/Transforms/Scalar/JumpThreading.cpp
==============================================================================
--- projects/clang391-import/contrib/llvm/lib/Transforms/Scalar/JumpThreading.cpp Sat Nov 26 00:59:01 2016 (r309174)
+++ projects/clang391-import/contrib/llvm/lib/Transforms/Scalar/JumpThreading.cpp Sat Nov 26 01:02:53 2016 (r309175)
@@ -1322,6 +1322,10 @@ bool JumpThreadingPass::ProcessBranchOnX
if (!isa<PHINode>(BB->front()))
return false;
+ // If this BB is a landing pad, we won't be able to split the edge into it.
+ if (BB->isEHPad())
+ return false;
+
// If we have a xor as the branch input to this block, and we know that the
// LHS or RHS of the xor in any predecessor is true/false, then we can clone
// the condition into the predecessor and fix that value to true, saving some
Modified: projects/clang391-import/contrib/llvm/tools/clang/include/clang/AST/DeclTemplate.h
==============================================================================
--- projects/clang391-import/contrib/llvm/tools/clang/include/clang/AST/DeclTemplate.h Sat Nov 26 00:59:01 2016 (r309174)
+++ projects/clang391-import/contrib/llvm/tools/clang/include/clang/AST/DeclTemplate.h Sat Nov 26 01:02:53 2016 (r309175)
@@ -44,6 +44,8 @@ class VarTemplatePartialSpecializationDe
typedef llvm::PointerUnion3<TemplateTypeParmDecl*, NonTypeTemplateParmDecl*,
TemplateTemplateParmDecl*> TemplateParameter;
+NamedDecl *getAsNamedDecl(TemplateParameter P);
+
/// \brief Stores a list of template parameters for a TemplateDecl and its
/// derived classes.
class TemplateParameterList final
@@ -2912,6 +2914,14 @@ public:
friend class ASTDeclWriter;
};
+inline NamedDecl *getAsNamedDecl(TemplateParameter P) {
+ if (auto *PD = P.dyn_cast<TemplateTypeParmDecl*>())
+ return PD;
+ if (auto *PD = P.dyn_cast<NonTypeTemplateParmDecl*>())
+ return PD;
+ return P.get<TemplateTemplateParmDecl*>();
+}
+
} /* end of namespace clang */
#endif
Modified: projects/clang391-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticDriverKinds.td
==============================================================================
--- projects/clang391-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticDriverKinds.td Sat Nov 26 00:59:01 2016 (r309174)
+++ projects/clang391-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticDriverKinds.td Sat Nov 26 01:02:53 2016 (r309175)
@@ -159,8 +159,6 @@ def err_drv_bitcode_unsupported_on_toolc
"-fembed-bitcode is not supported on versions of iOS prior to 6.0">;
def warn_O4_is_O3 : Warning<"-O4 is equivalent to -O3">, InGroup<Deprecated>;
-def warn_drv_lto_libpath : Warning<"libLTO.dylib relative to clang installed dir not found; using 'ld' default search path instead">,
- InGroup<LibLTO>;
def warn_drv_optimization_value : Warning<"optimization level '%0' is not supported; using '%1%2' instead">,
InGroup<InvalidCommandLineArgument>;
def warn_ignored_gcc_optimization : Warning<"optimization flag '%0' is not supported">,
Modified: projects/clang391-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td
==============================================================================
--- projects/clang391-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td Sat Nov 26 00:59:01 2016 (r309174)
+++ projects/clang391-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td Sat Nov 26 01:02:53 2016 (r309175)
@@ -4291,7 +4291,7 @@ def err_definition_of_implicitly_declare
def err_definition_of_explicitly_defaulted_member : Error<
"definition of explicitly defaulted %select{default constructor|copy "
"constructor|move constructor|copy assignment operator|move assignment "
- "operator|destructor}0">;
+ "operator|destructor|function}0">;
def err_redefinition_extern_inline : Error<
"redefinition of a 'extern inline' function %0 is not supported in "
"%select{C99 mode|C++}1">;
@@ -6917,6 +6917,10 @@ def err_in_class_initializer_not_yet_par
def err_in_class_initializer_not_yet_parsed_outer_class
: Error<"cannot use defaulted default constructor of %0 within "
"%1 outside of member functions because %2 has an initializer">;
+def err_in_class_initializer_cycle
+ : Error<"default member initializer for %0 uses itself">;
+def err_exception_spec_cycle
+ : Error<"exception specification of %0 uses itself">;
def ext_in_class_initializer_non_constant : Extension<
"in-class initializer for static data member is not a constant expression; "
Modified: projects/clang391-import/contrib/llvm/tools/clang/include/clang/Sema/Sema.h
==============================================================================
--- projects/clang391-import/contrib/llvm/tools/clang/include/clang/Sema/Sema.h Sat Nov 26 00:59:01 2016 (r309174)
+++ projects/clang391-import/contrib/llvm/tools/clang/include/clang/Sema/Sema.h Sat Nov 26 01:02:53 2016 (r309175)
@@ -18,6 +18,7 @@
#include "clang/AST/Attr.h"
#include "clang/AST/Availability.h"
#include "clang/AST/DeclarationName.h"
+#include "clang/AST/DeclTemplate.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprObjC.h"
#include "clang/AST/ExternalASTSource.h"
@@ -1217,8 +1218,10 @@ public:
/// \brief Retrieve the current block, if any.
sema::BlockScopeInfo *getCurBlock();
- /// \brief Retrieve the current lambda scope info, if any.
- sema::LambdaScopeInfo *getCurLambda();
+ /// Retrieve the current lambda scope info, if any.
+ /// \param IgnoreCapturedRegions true if should find the top-most lambda scope
+ /// info ignoring all inner captured regions scope infos.
+ sema::LambdaScopeInfo *getCurLambda(bool IgnoreCapturedRegions = false);
/// \brief Retrieve the current generic lambda info, if any.
sema::LambdaScopeInfo *getCurGenericLambda();
@@ -6613,10 +6616,10 @@ public:
TemplateInstantiation,
/// We are instantiating a default argument for a template
- /// parameter. The Entity is the template, and
- /// TemplateArgs/NumTemplateArguments provides the template
- /// arguments as specified.
- /// FIXME: Use a TemplateArgumentList
+ /// parameter. The Entity is the template parameter whose argument is
+ /// being instantiated, the Template is the template, and the
+ /// TemplateArgs/NumTemplateArguments provide the template arguments as
+ /// specified.
DefaultTemplateArgumentInstantiation,
/// We are instantiating a default argument for a function.
@@ -6731,6 +6734,9 @@ public:
SmallVector<ActiveTemplateInstantiation, 16>
ActiveTemplateInstantiations;
+ /// Specializations whose definitions are currently being instantiated.
+ llvm::DenseSet<std::pair<Decl *, unsigned>> InstantiatingSpecializations;
+
/// \brief Extra modules inspected when performing a lookup during a template
/// instantiation. Computed lazily.
SmallVector<Module*, 16> ActiveTemplateInstantiationLookupModules;
@@ -6837,12 +6843,12 @@ public:
/// \brief Note that we are instantiating a default argument in a
/// template-id.
InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
- TemplateDecl *Template,
+ TemplateParameter Param, TemplateDecl *Template,
ArrayRef<TemplateArgument> TemplateArgs,
SourceRange InstantiationRange = SourceRange());
- /// \brief Note that we are instantiating a default argument in a
- /// template-id.
+ /// \brief Note that we are substituting either explicitly-specified or
+ /// deduced template arguments during function template argument deduction.
InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
FunctionTemplateDecl *FunctionTemplate,
ArrayRef<TemplateArgument> TemplateArgs,
@@ -6909,9 +6915,14 @@ public:
/// recursive template instantiations.
bool isInvalid() const { return Invalid; }
+ /// \brief Determine whether we are already instantiating this
+ /// specialization in some surrounding active instantiation.
+ bool isAlreadyInstantiating() const { return AlreadyInstantiating; }
+
private:
Sema &SemaRef;
bool Invalid;
+ bool AlreadyInstantiating;
bool SavedInNonInstantiationSFINAEContext;
bool CheckInstantiationDepth(SourceLocation PointOfInstantiation,
SourceRange InstantiationRange);
Modified: projects/clang391-import/contrib/llvm/tools/clang/lib/Basic/Targets.cpp
==============================================================================
--- projects/clang391-import/contrib/llvm/tools/clang/lib/Basic/Targets.cpp Sat Nov 26 00:59:01 2016 (r309174)
+++ projects/clang391-import/contrib/llvm/tools/clang/lib/Basic/Targets.cpp Sat Nov 26 01:02:53 2016 (r309175)
@@ -158,14 +158,25 @@ static void getDarwinDefines(MacroBuilde
// Set the appropriate OS version define.
if (Triple.isiOS()) {
- assert(Maj < 10 && Min < 100 && Rev < 100 && "Invalid version!");
- char Str[6];
- Str[0] = '0' + Maj;
- Str[1] = '0' + (Min / 10);
- Str[2] = '0' + (Min % 10);
- Str[3] = '0' + (Rev / 10);
- Str[4] = '0' + (Rev % 10);
- Str[5] = '\0';
+ assert(Maj < 100 && Min < 100 && Rev < 100 && "Invalid version!");
+ char Str[7];
+ if (Maj < 10) {
+ Str[0] = '0' + Maj;
+ Str[1] = '0' + (Min / 10);
+ Str[2] = '0' + (Min % 10);
+ Str[3] = '0' + (Rev / 10);
+ Str[4] = '0' + (Rev % 10);
+ Str[5] = '\0';
+ } else {
+ // Handle versions >= 10.
+ Str[0] = '0' + (Maj / 10);
+ Str[1] = '0' + (Maj % 10);
+ Str[2] = '0' + (Min / 10);
+ Str[3] = '0' + (Min % 10);
+ Str[4] = '0' + (Rev / 10);
+ Str[5] = '0' + (Rev % 10);
+ Str[6] = '\0';
+ }
if (Triple.isTvOS())
Builder.defineMacro("__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__", Str);
else
@@ -8170,6 +8181,8 @@ static TargetInfo *AllocateTarget(const
return new DarwinARMTargetInfo(Triple, Opts);
switch (os) {
+ case llvm::Triple::CloudABI:
+ return new CloudABITargetInfo<ARMleTargetInfo>(Triple, Opts);
case llvm::Triple::Linux:
return new LinuxTargetInfo<ARMleTargetInfo>(Triple, Opts);
case llvm::Triple::FreeBSD:
Modified: projects/clang391-import/contrib/llvm/tools/clang/lib/Basic/Version.cpp
==============================================================================
--- projects/clang391-import/contrib/llvm/tools/clang/lib/Basic/Version.cpp Sat Nov 26 00:59:01 2016 (r309174)
+++ projects/clang391-import/contrib/llvm/tools/clang/lib/Basic/Version.cpp Sat Nov 26 01:02:53 2016 (r309175)
@@ -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/tags/RELEASE_390/final/lib/Basic/Version.cpp $");
+ StringRef SVNRepository("$URL: https://llvm.org/svn/llvm-project/cfe/branches/release_39/lib/Basic/Version.cpp $");
if (URL.empty()) {
URL = SVNRepository.slice(SVNRepository.find(':'),
SVNRepository.find("/lib/Basic"));
Modified: projects/clang391-import/contrib/llvm/tools/clang/lib/CodeGen/CGExpr.cpp
==============================================================================
--- projects/clang391-import/contrib/llvm/tools/clang/lib/CodeGen/CGExpr.cpp Sat Nov 26 00:59:01 2016 (r309174)
+++ projects/clang391-import/contrib/llvm/tools/clang/lib/CodeGen/CGExpr.cpp Sat Nov 26 01:02:53 2016 (r309175)
@@ -2105,12 +2105,11 @@ LValue CodeGenFunction::EmitDeclRefLValu
if (auto *FD = LambdaCaptureFields.lookup(VD))
return EmitCapturedFieldLValue(*this, FD, CXXABIThisValue);
else if (CapturedStmtInfo) {
- auto it = LocalDeclMap.find(VD);
- if (it != LocalDeclMap.end()) {
- if (auto RefTy = VD->getType()->getAs<ReferenceType>()) {
- return EmitLoadOfReferenceLValue(it->second, RefTy);
- }
- return MakeAddrLValue(it->second, T);
+ auto I = LocalDeclMap.find(VD);
+ if (I != LocalDeclMap.end()) {
+ if (auto RefTy = VD->getType()->getAs<ReferenceType>())
+ return EmitLoadOfReferenceLValue(I->second, RefTy);
+ return MakeAddrLValue(I->second, T);
}
LValue CapLVal =
EmitCapturedFieldLValue(*this, CapturedStmtInfo->lookup(VD),
@@ -2249,13 +2248,15 @@ LValue CodeGenFunction::EmitUnaryOpLValu
return LV;
}
- assert(E->getSubExpr()->getType()->isAnyComplexType());
+ QualType T = ExprTy->castAs<ComplexType>()->getElementType();
Address Component =
(E->getOpcode() == UO_Real
? emitAddrOfRealComponent(LV.getAddress(), LV.getType())
: emitAddrOfImagComponent(LV.getAddress(), LV.getType()));
- return MakeAddrLValue(Component, ExprTy, LV.getAlignmentSource());
+ LValue ElemLV = MakeAddrLValue(Component, T, LV.getAlignmentSource());
+ ElemLV.getQuals().addQualifiers(LV.getQuals());
+ return ElemLV;
}
case UO_PreInc:
case UO_PreDec: {
Modified: projects/clang391-import/contrib/llvm/tools/clang/lib/CodeGen/CGStmt.cpp
==============================================================================
--- projects/clang391-import/contrib/llvm/tools/clang/lib/CodeGen/CGStmt.cpp Sat Nov 26 00:59:01 2016 (r309174)
+++ projects/clang391-import/contrib/llvm/tools/clang/lib/CodeGen/CGStmt.cpp Sat Nov 26 01:02:53 2016 (r309175)
@@ -1323,6 +1323,10 @@ static CSFC_Result CollectStatementsForC
// Handle this as two cases: we might be looking for the SwitchCase (if so
// the skipped statements must be skippable) or we might already have it.
CompoundStmt::const_body_iterator I = CS->body_begin(), E = CS->body_end();
+ bool StartedInLiveCode = FoundCase;
+ unsigned StartSize = ResultStmts.size();
+
+ // If we've not found the case yet, scan through looking for it.
if (Case) {
// Keep track of whether we see a skipped declaration. The code could be
// using the declaration even if it is skipped, so we can't optimize out
@@ -1332,7 +1336,7 @@ static CSFC_Result CollectStatementsForC
// If we're looking for the case, just see if we can skip each of the
// substatements.
for (; Case && I != E; ++I) {
- HadSkippedDecl |= isa<DeclStmt>(*I);
+ HadSkippedDecl |= CodeGenFunction::mightAddDeclToScope(*I);
switch (CollectStatementsForCase(*I, Case, FoundCase, ResultStmts)) {
case CSFC_Failure: return CSFC_Failure;
@@ -1368,11 +1372,19 @@ static CSFC_Result CollectStatementsForC
break;
}
}
+
+ if (!FoundCase)
+ return CSFC_Success;
+
+ assert(!HadSkippedDecl && "fallthrough after skipping decl");
}
// If we have statements in our range, then we know that the statements are
// live and need to be added to the set of statements we're tracking.
+ bool AnyDecls = false;
for (; I != E; ++I) {
+ AnyDecls |= CodeGenFunction::mightAddDeclToScope(*I);
+
switch (CollectStatementsForCase(*I, nullptr, FoundCase, ResultStmts)) {
case CSFC_Failure: return CSFC_Failure;
case CSFC_FallThrough:
@@ -1390,7 +1402,24 @@ static CSFC_Result CollectStatementsForC
}
}
- return Case ? CSFC_Success : CSFC_FallThrough;
+ // If we're about to fall out of a scope without hitting a 'break;', we
+ // can't perform the optimization if there were any decls in that scope
+ // (we'd lose their end-of-lifetime).
+ if (AnyDecls) {
+ // If the entire compound statement was live, there's one more thing we
+ // can try before giving up: emit the whole thing as a single statement.
+ // We can do that unless the statement contains a 'break;'.
+ // FIXME: Such a break must be at the end of a construct within this one.
+ // We could emit this by just ignoring the BreakStmts entirely.
+ if (StartedInLiveCode && !CodeGenFunction::containsBreak(S)) {
+ ResultStmts.resize(StartSize);
+ ResultStmts.push_back(S);
+ } else {
+ return CSFC_Failure;
+ }
+ }
+
+ return CSFC_FallThrough;
}
// Okay, this is some other statement that we don't handle explicitly, like a
Modified: projects/clang391-import/contrib/llvm/tools/clang/lib/CodeGen/CGStmtOpenMP.cpp
==============================================================================
--- projects/clang391-import/contrib/llvm/tools/clang/lib/CodeGen/CGStmtOpenMP.cpp Sat Nov 26 00:59:01 2016 (r309174)
+++ projects/clang391-import/contrib/llvm/tools/clang/lib/CodeGen/CGStmtOpenMP.cpp Sat Nov 26 01:02:53 2016 (r309175)
@@ -232,8 +232,15 @@ CodeGenFunction::GenerateOpenMPCapturedS
assert(I->capturesVariableArrayType());
II = &getContext().Idents.get("vla");
}
- if (ArgType->isVariablyModifiedType())
- ArgType = getContext().getVariableArrayDecayedType(ArgType);
+ if (ArgType->isVariablyModifiedType()) {
+ bool IsReference = ArgType->isLValueReferenceType();
+ ArgType =
+ getContext().getCanonicalParamType(ArgType.getNonReferenceType());
+ if (IsReference && !ArgType->isPointerType()) {
+ ArgType = getContext().getLValueReferenceType(
+ ArgType, /*SpelledAsLValue=*/false);
+ }
+ }
Args.push_back(ImplicitParamDecl::Create(getContext(), nullptr,
FD->getLocation(), II, ArgType));
++I;
@@ -287,8 +294,14 @@ CodeGenFunction::GenerateOpenMPCapturedS
QualType VarTy = Var->getType();
Address ArgAddr = ArgLVal.getAddress();
if (!VarTy->isReferenceType()) {
- ArgAddr = EmitLoadOfReference(
- ArgAddr, ArgLVal.getType()->castAs<ReferenceType>());
+ if (ArgLVal.getType()->isLValueReferenceType()) {
+ ArgAddr = EmitLoadOfReference(
+ ArgAddr, ArgLVal.getType()->castAs<ReferenceType>());
+ } else if (!VarTy->isVariablyModifiedType() || !VarTy->isPointerType()) {
+ assert(ArgLVal.getType()->isPointerType());
+ ArgAddr = EmitLoadOfPointer(
+ ArgAddr, ArgLVal.getType()->castAs<PointerType>());
+ }
}
setAddrOfLocalVar(
Var, Address(ArgAddr.getPointer(), getContext().getDeclAlign(Var)));
@@ -1754,9 +1767,17 @@ void CodeGenFunction::EmitOMPOuterLoop(b
EmitBlock(LoopExit.getBlock());
// Tell the runtime we are done.
- if (!DynamicOrOrdered)
- RT.emitForStaticFinish(*this, S.getLocEnd());
-
+ SourceLocation ELoc = S.getLocEnd();
+ auto &&CodeGen = [DynamicOrOrdered, ELoc](CodeGenFunction &CGF) {
+ if (!DynamicOrOrdered)
+ CGF.CGM.getOpenMPRuntime().emitForStaticFinish(CGF, ELoc);
+ };
+ CodeGen(*this);
+
+ OpenMPDirectiveKind DKind = S.getDirectiveKind();
+ if (DKind == OMPD_for || DKind == OMPD_parallel_for ||
+ DKind == OMPD_distribute_parallel_for)
+ OMPCancelStack.back().CodeGen = CodeGen;
}
void CodeGenFunction::EmitOMPForOuterLoop(
@@ -1868,6 +1889,7 @@ void CodeGenFunction::EmitOMPDistributeO
void CodeGenFunction::EmitOMPDistributeParallelForDirective(
const OMPDistributeParallelForDirective &S) {
OMPLexicalScope Scope(*this, S, /*AsInlined=*/true);
+ OMPCancelStackRAII CancelRegion(*this);
CGM.getOpenMPRuntime().emitInlinedDirective(
*this, OMPD_distribute_parallel_for,
[&S](CodeGenFunction &CGF, PrePostActionTy &) {
@@ -2060,7 +2082,15 @@ bool CodeGenFunction::EmitOMPWorksharing
[](CodeGenFunction &) {});
EmitBlock(LoopExit.getBlock());
// Tell the runtime we are done.
- RT.emitForStaticFinish(*this, S.getLocStart());
+ SourceLocation ELoc = S.getLocEnd();
+ auto &&CodeGen = [ELoc](CodeGenFunction &CGF) {
+ CGF.CGM.getOpenMPRuntime().emitForStaticFinish(CGF, ELoc);
+ };
+ CodeGen(*this);
+ OpenMPDirectiveKind DKind = S.getDirectiveKind();
+ if (DKind == OMPD_for || DKind == OMPD_parallel_for ||
+ DKind == OMPD_distribute_parallel_for)
+ OMPCancelStack.back().CodeGen = CodeGen;
} else {
const bool IsMonotonic =
Ordered || ScheduleKind.Schedule == OMPC_SCHEDULE_static ||
@@ -2114,6 +2144,7 @@ void CodeGenFunction::EmitOMPForDirectiv
};
{
OMPLexicalScope Scope(*this, S, /*AsInlined=*/true);
+ OMPCancelStackRAII CancelRegion(*this);
CGM.getOpenMPRuntime().emitInlinedDirective(*this, OMPD_for, CodeGen,
S.hasCancel());
}
@@ -2156,6 +2187,7 @@ void CodeGenFunction::EmitSections(const
bool HasLastprivates = false;
auto &&CodeGen = [&S, Stmt, CS, &HasLastprivates](CodeGenFunction &CGF,
PrePostActionTy &) {
+ OMPCancelStackRAII CancelRegion(CGF);
auto &C = CGF.CGM.getContext();
auto KmpInt32Ty = C.getIntTypeForBitwidth(/*DestWidth=*/32, /*Signed=*/1);
// Emit helper vars inits.
@@ -2250,7 +2282,12 @@ void CodeGenFunction::EmitSections(const
CGF.EmitOMPInnerLoop(S, /*RequiresCleanup=*/false, &Cond, &Inc, BodyGen,
[](CodeGenFunction &) {});
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-projects
mailing list