From 15c5c77fa04cd97e1057e8a585f669fc49da0d92 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 20 Aug 2017 21:02:43 +0000 Subject: [PATCH 1/4] Vendor import of llvm release_50 branch r311219: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311219 --- CMakeLists.txt | 2 +- docs/LangRef.rst | 4 + docs/ReleaseNotes.rst | 36 ++++- include/llvm/CodeGen/SelectionDAG.h | 5 +- .../ExecutionEngine/Orc/LazyEmittingLayer.h | 10 +- include/llvm/Object/COFFImportFile.h | 4 +- lib/Analysis/ScalarEvolution.cpp | 30 ++++ lib/Analysis/ValueTracking.cpp | 4 + .../SelectionDAG/LegalizeVectorTypes.cpp | 16 +- lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 11 +- lib/CodeGen/VirtRegMap.cpp | 30 +++- lib/DebugInfo/DWARF/DWARFContext.cpp | 4 +- lib/DebugInfo/DWARF/DWARFVerifier.cpp | 8 +- lib/Object/COFFImportFile.cpp | 6 +- .../AArch64/AArch64LoadStoreOptimizer.cpp | 19 ++- lib/Target/ARM/ARMExpandPseudoInsts.cpp | 38 ++--- lib/Target/ARM/ARMInstrInfo.td | 10 +- lib/Target/X86/X86ISelLowering.cpp | 44 +++++- lib/Target/X86/X86InstrAVX512.td | 55 +++++-- .../llvm-dlltool/DlltoolDriver.cpp | 23 ++- .../Instrumentation/DataFlowSanitizer.cpp | 10 ++ lib/Transforms/Scalar/BDCE.cpp | 44 ++++++ .../ScalarEvolution/max-addrec-size.ll | 33 ++++ .../AArch64/arm64-ldst-unscaled-pre-post.mir | 115 ++++++++++++++ test/CodeGen/ARM/cmpxchg-O0.ll | 9 +- .../ARM/virtregrewriter-subregliveness.mir | 84 +++++++++++ test/CodeGen/X86/adx-intrinsics.ll | 27 ++++ test/CodeGen/X86/avx512bw-intrinsics.ll | 26 ++-- test/CodeGen/X86/avx512bwvl-intrinsics.ll | 24 +-- test/CodeGen/X86/pr33349.ll | 92 ++++++++++++ test/CodeGen/X86/pr34088.ll | 46 ++++++ test/CodeGen/X86/select-mmx.ll | 120 +++++++++++++++ test/CodeGen/X86/vector-shuffle-128-v16.ll | 4 +- test/CodeGen/X86/vector-shuffle-128-v8.ll | 6 +- test/CodeGen/X86/vector-shuffle-256-v16.ll | 2 +- test/CodeGen/X86/vector-shuffle-256-v32.ll | 2 +- test/CodeGen/X86/vector-shuffle-512-v32.ll | 8 +- test/CodeGen/X86/vector-shuffle-512-v64.ll | 4 +- .../Inputs/shadow-args-abilist.txt | 8 + .../DataFlowSanitizer/abilist.ll | 10 +- .../DataFlowSanitizer/shadow-args-zext.ll | 54 +++++++ .../Transforms/BDCE/invalidate-assumptions.ll | 100 +++++++++++++ .../IndVarSimplify/exit_value_test2.ll | 28 +++- test/Transforms/SimplifyCFG/pr34131.ll | 74 +++++++++ tools/llvm-objdump/llvm-objdump.cpp | 2 +- utils/lit/lit/LitConfig.py | 2 +- utils/lit/lit/TestRunner.py | 2 +- utils/lit/lit/formats/__init__.py | 7 +- utils/lit/lit/formats/base.py | 141 +++++++++++++----- utils/lit/lit/formats/shtest.py | 33 +--- utils/lit/lit/run.py | 13 +- utils/lit/tests/Inputs/max-failures/lit.cfg | 6 + utils/lit/tests/max-failures.py | 8 +- utils/lit/tests/selecting.py | 2 +- utils/release/test-release.sh | 21 ++- 55 files changed, 1298 insertions(+), 228 deletions(-) create mode 100644 test/Analysis/ScalarEvolution/max-addrec-size.ll create mode 100644 test/CodeGen/AArch64/arm64-ldst-unscaled-pre-post.mir create mode 100644 test/CodeGen/ARM/virtregrewriter-subregliveness.mir create mode 100644 test/CodeGen/X86/pr33349.ll create mode 100644 test/CodeGen/X86/pr34088.ll create mode 100644 test/CodeGen/X86/select-mmx.ll create mode 100644 test/Instrumentation/DataFlowSanitizer/Inputs/shadow-args-abilist.txt create mode 100644 test/Instrumentation/DataFlowSanitizer/shadow-args-zext.ll create mode 100644 test/Transforms/BDCE/invalidate-assumptions.ll create mode 100644 test/Transforms/SimplifyCFG/pr34131.ll create mode 100644 utils/lit/tests/Inputs/max-failures/lit.cfg diff --git a/CMakeLists.txt b/CMakeLists.txt index 6af2cba10093..8c0f51145139 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -314,6 +314,7 @@ set(LLVM_CMAKE_PATH ${LLVM_MAIN_SRC_DIR}/cmake/modules) set(LLVM_EXAMPLES_BINARY_DIR ${LLVM_BINARY_DIR}/examples) set(LLVM_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include) +# List of all targets to be built by default: set(LLVM_ALL_TARGETS AArch64 AMDGPU @@ -325,7 +326,6 @@ set(LLVM_ALL_TARGETS MSP430 NVPTX PowerPC - RISCV Sparc SystemZ X86 diff --git a/docs/LangRef.rst b/docs/LangRef.rst index 44efc1498060..5c65864e901e 100644 --- a/docs/LangRef.rst +++ b/docs/LangRef.rst @@ -5369,6 +5369,10 @@ The following behaviors are supported: nodes. However, duplicate entries in the second list are dropped during the append operation. + * - 7 + - **Max** + Takes the max of the two values, which are required to be integers. + It is an error for a particular unique flag ID to have multiple behaviors, except in the case of **Require** (which adds restrictions on another metadata value) or **Override**. diff --git a/docs/ReleaseNotes.rst b/docs/ReleaseNotes.rst index dcd2ec7eb22b..48af491f1214 100644 --- a/docs/ReleaseNotes.rst +++ b/docs/ReleaseNotes.rst @@ -117,6 +117,18 @@ Changes to the X86 Target * Added support for AMD Lightweight Profiling (LWP) instructions. +* Avoid using slow LEA instructions. + +* Use alternative sequences for multiply by constant. + +* Improved lowering of strided shuffles. + +* Improved the AVX512 cost model used by the vectorizer. + +* Fix scalar code performance when AVX512 is enabled by making i1's illegal. + +* Fixed many inline assembly bugs. + Changes to the AMDGPU Target ----------------------------- @@ -160,7 +172,29 @@ Changes to the C API External Open Source Projects Using LLVM 5 ========================================== -* A project... +Zig Programming Language +------------------------ + +`Zig `_ is an open-source programming language designed +for robustness, optimality, and clarity. It integrates closely with C and is +intended to eventually take the place of C. It uses LLVM to produce highly +optimized native code and to cross-compile for any target out of the box. Zig +is in alpha; with a beta release expected in September. + +LDC - the LLVM-based D compiler +------------------------------- + +`D `_ is a language with C-like syntax and static typing. It +pragmatically combines efficiency, control, and modeling power, with safety and +programmer productivity. D supports powerful concepts like Compile-Time Function +Execution (CTFE) and Template Meta-Programming, provides an innovative approach +to concurrency and offers many classical paradigms. + +`LDC `_ uses the frontend from the reference compiler +combined with LLVM as backend to produce efficient native code. LDC targets +x86/x86_64 systems like Linux, OS X, FreeBSD and Windows and also Linux on ARM +and PowerPC (32/64 bit). Ports to other architectures like AArch64 and MIPS64 +are underway. Additional Information diff --git a/include/llvm/CodeGen/SelectionDAG.h b/include/llvm/CodeGen/SelectionDAG.h index 55a23c3cca9b..d6851f7143a5 100644 --- a/include/llvm/CodeGen/SelectionDAG.h +++ b/include/llvm/CodeGen/SelectionDAG.h @@ -1220,8 +1220,9 @@ class SelectionDAG { /// If an existing load has uses of its chain, create a token factor node with /// that chain and the new memory node's chain and update users of the old /// chain to the token factor. This ensures that the new memory node will have - /// the same relative memory dependency position as the old load. - void makeEquivalentMemoryOrdering(LoadSDNode *Old, SDValue New); + /// the same relative memory dependency position as the old load. Returns the + /// new merged load chain. + SDValue makeEquivalentMemoryOrdering(LoadSDNode *Old, SDValue New); /// Topological-sort the AllNodes list and a /// assign a unique node id for each node in the DAG based on their diff --git a/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h b/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h index 6c951fab6185..b7e462e85d9d 100644 --- a/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h +++ b/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h @@ -94,9 +94,9 @@ template class LazyEmittingLayer { llvm_unreachable("Invalid emit-state."); } - void removeModuleFromBaseLayer(BaseLayerT &BaseLayer) { - if (EmitState != NotEmitted) - BaseLayer.removeModule(Handle); + Error removeModuleFromBaseLayer(BaseLayerT& BaseLayer) { + return EmitState != NotEmitted ? BaseLayer.removeModule(Handle) + : Error::success(); } void emitAndFinalize(BaseLayerT &BaseLayer) { @@ -226,9 +226,9 @@ template class LazyEmittingLayer { /// This method will free the memory associated with the given module, both /// in this layer, and the base layer. Error removeModule(ModuleHandleT H) { - (*H)->removeModuleFromBaseLayer(BaseLayer); + Error Err = (*H)->removeModuleFromBaseLayer(BaseLayer); ModuleList.erase(H); - return Error::success(); + return Err; } /// @brief Search for the given named symbol. diff --git a/include/llvm/Object/COFFImportFile.h b/include/llvm/Object/COFFImportFile.h index 8e215b565fc4..cf9c80a06f49 100644 --- a/include/llvm/Object/COFFImportFile.h +++ b/include/llvm/Object/COFFImportFile.h @@ -73,6 +73,7 @@ class COFFImportFile : public SymbolicFile { struct COFFShortExport { std::string Name; std::string ExtName; + std::string SymbolName; uint16_t Ordinal = 0; bool Noname = false; @@ -98,7 +99,8 @@ struct COFFShortExport { std::error_code writeImportLibrary(StringRef ImportName, StringRef Path, ArrayRef Exports, - COFF::MachineTypes Machine); + COFF::MachineTypes Machine, + bool MakeWeakAliases); } // namespace object } // namespace llvm diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index b973203a89b6..9539fd7c7559 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -162,6 +162,11 @@ static cl::opt cl::desc("Maximum depth of recursive SExt/ZExt"), cl::init(8)); +static cl::opt + MaxAddRecSize("scalar-evolution-max-add-rec-size", cl::Hidden, + cl::desc("Max coefficients in AddRec during evolving"), + cl::init(16)); + //===----------------------------------------------------------------------===// // SCEV class definitions //===----------------------------------------------------------------------===// @@ -2878,6 +2883,12 @@ const SCEV *ScalarEvolution::getMulExpr(SmallVectorImpl &Ops, if (!OtherAddRec || OtherAddRec->getLoop() != AddRecLoop) continue; + // Limit max number of arguments to avoid creation of unreasonably big + // SCEVAddRecs with very complex operands. + if (AddRec->getNumOperands() + OtherAddRec->getNumOperands() - 1 > + MaxAddRecSize) + continue; + bool Overflow = false; Type *Ty = AddRec->getType(); bool LargerThan64Bits = getTypeSizeInBits(Ty) > 64; @@ -7582,6 +7593,25 @@ const SCEV *ScalarEvolution::computeSCEVAtScope(const SCEV *V, const Loop *L) { const SCEV *BackedgeTakenCount = getBackedgeTakenCount(LI); if (const SCEVConstant *BTCC = dyn_cast(BackedgeTakenCount)) { + + // This trivial case can show up in some degenerate cases where + // the incoming IR has not yet been fully simplified. + if (BTCC->getValue()->isZero()) { + Value *InitValue = nullptr; + bool MultipleInitValues = false; + for (unsigned i = 0; i < PN->getNumIncomingValues(); i++) { + if (!LI->contains(PN->getIncomingBlock(i))) { + if (!InitValue) + InitValue = PN->getIncomingValue(i); + else if (InitValue != PN->getIncomingValue(i)) { + MultipleInitValues = true; + break; + } + } + if (!MultipleInitValues && InitValue) + return getSCEV(InitValue); + } + } // Okay, we know how many times the containing loop executes. If // this is a constant evolving PHI node, get the final value at // the specified iteration number. diff --git a/lib/Analysis/ValueTracking.cpp b/lib/Analysis/ValueTracking.cpp index 439b21a81258..cdfe74d158c9 100644 --- a/lib/Analysis/ValueTracking.cpp +++ b/lib/Analysis/ValueTracking.cpp @@ -4458,6 +4458,10 @@ Optional llvm::isImpliedCondition(const Value *LHS, const Value *RHS, unsigned Depth, AssumptionCache *AC, const Instruction *CxtI, const DominatorTree *DT) { + // Bail out when we hit the limit. + if (Depth == MaxDepth) + return None; + // A mismatch occurs when we compare a scalar cmp to a vector cmp, for example. if (LHS->getType() != RHS->getType()) return None; diff --git a/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp b/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp index 0cad20db0964..ecb54e1e4b41 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp @@ -302,7 +302,21 @@ SDValue DAGTypeLegalizer::ScalarizeVecRes_SCALAR_TO_VECTOR(SDNode *N) { } SDValue DAGTypeLegalizer::ScalarizeVecRes_VSELECT(SDNode *N) { - SDValue Cond = GetScalarizedVector(N->getOperand(0)); + SDValue Cond = N->getOperand(0); + EVT OpVT = Cond.getValueType(); + SDLoc DL(N); + // The vselect result and true/value operands needs scalarizing, but it's + // not a given that the Cond does. For instance, in AVX512 v1i1 is legal. + // See the similar logic in ScalarizeVecRes_VSETCC + if (getTypeAction(OpVT) == TargetLowering::TypeScalarizeVector) { + Cond = GetScalarizedVector(Cond); + } else { + EVT VT = OpVT.getVectorElementType(); + Cond = DAG.getNode( + ISD::EXTRACT_VECTOR_ELT, DL, VT, Cond, + DAG.getConstant(0, DL, TLI.getVectorIdxTy(DAG.getDataLayout()))); + } + SDValue LHS = GetScalarizedVector(N->getOperand(1)); TargetLowering::BooleanContent ScalarBool = TLI.getBooleanContents(false, false); diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 823e77850c4b..0ff154784f68 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -7262,22 +7262,23 @@ void SelectionDAG::TransferDbgValues(SDValue From, SDValue To) { AddDbgValue(I, ToNode, false); } -void SelectionDAG::makeEquivalentMemoryOrdering(LoadSDNode *OldLoad, - SDValue NewMemOp) { +SDValue SelectionDAG::makeEquivalentMemoryOrdering(LoadSDNode *OldLoad, + SDValue NewMemOp) { assert(isa(NewMemOp.getNode()) && "Expected a memop node"); - if (!OldLoad->hasAnyUseOfValue(1)) - return; - // The new memory operation must have the same position as the old load in // terms of memory dependency. Create a TokenFactor for the old load and new // memory operation and update uses of the old load's output chain to use that // TokenFactor. SDValue OldChain = SDValue(OldLoad, 1); SDValue NewChain = SDValue(NewMemOp.getNode(), 1); + if (!OldLoad->hasAnyUseOfValue(1)) + return NewChain; + SDValue TokenFactor = getNode(ISD::TokenFactor, SDLoc(OldLoad), MVT::Other, OldChain, NewChain); ReplaceAllUsesOfValueWith(OldChain, TokenFactor); UpdateNodeOperands(TokenFactor.getNode(), OldChain, NewChain); + return TokenFactor; } //===----------------------------------------------------------------------===// diff --git a/lib/CodeGen/VirtRegMap.cpp b/lib/CodeGen/VirtRegMap.cpp index 124c2790f68c..f8aacdb8649d 100644 --- a/lib/CodeGen/VirtRegMap.cpp +++ b/lib/CodeGen/VirtRegMap.cpp @@ -180,6 +180,7 @@ class VirtRegRewriter : public MachineFunctionPass { void addLiveInsForSubRanges(const LiveInterval &LI, unsigned PhysReg) const; void handleIdentityCopy(MachineInstr &MI) const; void expandCopyBundle(MachineInstr &MI) const; + bool subRegLiveThrough(const MachineInstr &MI, unsigned SuperPhysReg) const; public: static char ID; @@ -415,6 +416,32 @@ void VirtRegRewriter::expandCopyBundle(MachineInstr &MI) const { } } +/// Check whether (part of) \p SuperPhysReg is live through \p MI. +/// \pre \p MI defines a subregister of a virtual register that +/// has been assigned to \p SuperPhysReg. +bool VirtRegRewriter::subRegLiveThrough(const MachineInstr &MI, + unsigned SuperPhysReg) const { + SlotIndex MIIndex = LIS->getInstructionIndex(MI); + SlotIndex BeforeMIUses = MIIndex.getBaseIndex(); + SlotIndex AfterMIDefs = MIIndex.getBoundaryIndex(); + for (MCRegUnitIterator Unit(SuperPhysReg, TRI); Unit.isValid(); ++Unit) { + const LiveRange &UnitRange = LIS->getRegUnit(*Unit); + // If the regunit is live both before and after MI, + // we assume it is live through. + // Generally speaking, this is not true, because something like + // "RU = op RU" would match that description. + // However, we know that we are trying to assess whether + // a def of a virtual reg, vreg, is live at the same time of RU. + // If we are in the "RU = op RU" situation, that means that vreg + // is defined at the same time as RU (i.e., "vreg, RU = op RU"). + // Thus, vreg and RU interferes and vreg cannot be assigned to + // SuperPhysReg. Therefore, this situation cannot happen. + if (UnitRange.liveAt(AfterMIDefs) && UnitRange.liveAt(BeforeMIUses)) + return true; + } + return false; +} + void VirtRegRewriter::rewrite() { bool NoSubRegLiveness = !MRI->subRegLivenessEnabled(); SmallVector SuperDeads; @@ -452,7 +479,8 @@ void VirtRegRewriter::rewrite() { // A virtual register kill refers to the whole register, so we may // have to add operands for the super-register. A // partial redef always kills and redefines the super-register. - if (MO.readsReg() && (MO.isDef() || MO.isKill())) + if ((MO.readsReg() && (MO.isDef() || MO.isKill())) || + (MO.isDef() && subRegLiveThrough(*MI, PhysReg))) SuperKills.push_back(PhysReg); if (MO.isDef()) { diff --git a/lib/DebugInfo/DWARF/DWARFContext.cpp b/lib/DebugInfo/DWARF/DWARFContext.cpp index 495e09fbae35..dd3235244e24 100644 --- a/lib/DebugInfo/DWARF/DWARFContext.cpp +++ b/lib/DebugInfo/DWARF/DWARFContext.cpp @@ -134,13 +134,13 @@ dumpDWARFv5StringOffsetsSection(raw_ostream &OS, StringRef SectionName, uint64_t StringOffset = StrOffsetExt.getRelocatedValue(EntrySize, &Offset); if (Format == DWARF32) { - OS << format("%8.8x ", StringOffset); uint32_t StringOffset32 = (uint32_t)StringOffset; + OS << format("%8.8x ", StringOffset32); const char *S = StrData.getCStr(&StringOffset32); if (S) OS << format("\"%s\"", S); } else - OS << format("%16.16x ", StringOffset); + OS << format("%16.16" PRIx64 " ", StringOffset); OS << "\n"; } } diff --git a/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/lib/DebugInfo/DWARF/DWARFVerifier.cpp index 6cf44ffa3796..4de46bea301e 100644 --- a/lib/DebugInfo/DWARF/DWARFVerifier.cpp +++ b/lib/DebugInfo/DWARF/DWARFVerifier.cpp @@ -196,7 +196,7 @@ unsigned DWARFVerifier::verifyDebugInfoAttribute(const DWARFDie &Die, ++NumErrors; OS << "error: DW_AT_stmt_list offset is beyond .debug_line " "bounds: " - << format("0x%08" PRIx32, *SectionOffset) << "\n"; + << format("0x%08" PRIx64, *SectionOffset) << "\n"; Die.dump(OS, 0); OS << "\n"; } @@ -234,7 +234,7 @@ unsigned DWARFVerifier::verifyDebugInfoForm(const DWARFDie &Die, if (CUOffset >= CUSize) { ++NumErrors; OS << "error: " << FormEncodingString(Form) << " CU offset " - << format("0x%08" PRIx32, CUOffset) + << format("0x%08" PRIx64, CUOffset) << " is invalid (must be less than CU size of " << format("0x%08" PRIx32, CUSize) << "):\n"; Die.dump(OS, 0); @@ -366,7 +366,7 @@ void DWARFVerifier::verifyDebugLineRows() { if (Row.Address < PrevAddress) { ++NumDebugLineErrors; OS << "error: .debug_line[" - << format("0x%08" PRIx32, + << format("0x%08" PRIx64, *toSectionOffset(Die.find(DW_AT_stmt_list))) << "] row[" << RowIndex << "] decreases in address from previous row:\n"; @@ -381,7 +381,7 @@ void DWARFVerifier::verifyDebugLineRows() { if (Row.File > MaxFileIndex) { ++NumDebugLineErrors; OS << "error: .debug_line[" - << format("0x%08" PRIx32, + << format("0x%08" PRIx64, *toSectionOffset(Die.find(DW_AT_stmt_list))) << "][" << RowIndex << "] has invalid file index " << Row.File << " (valid values are [1," << MaxFileIndex << "]):\n"; diff --git a/lib/Object/COFFImportFile.cpp b/lib/Object/COFFImportFile.cpp index a515bc8ad16d..ff039463d08c 100644 --- a/lib/Object/COFFImportFile.cpp +++ b/lib/Object/COFFImportFile.cpp @@ -557,7 +557,7 @@ NewArchiveMember ObjectFactory::createWeakExternal(StringRef Sym, std::error_code writeImportLibrary(StringRef ImportName, StringRef Path, ArrayRef Exports, - MachineTypes Machine) { + MachineTypes Machine, bool MakeWeakAliases) { std::vector Members; ObjectFactory OF(llvm::sys::path::filename(ImportName), Machine); @@ -575,7 +575,7 @@ std::error_code writeImportLibrary(StringRef ImportName, StringRef Path, if (E.Private) continue; - if (E.isWeak()) { + if (E.isWeak() && MakeWeakAliases) { Members.push_back(OF.createWeakExternal(E.Name, E.ExtName, false)); Members.push_back(OF.createWeakExternal(E.Name, E.ExtName, true)); continue; @@ -587,7 +587,7 @@ std::error_code writeImportLibrary(StringRef ImportName, StringRef Path, if (E.Constant) ImportType = IMPORT_CONST; - StringRef SymbolName = E.isWeak() ? E.ExtName : E.Name; + StringRef SymbolName = E.SymbolName.empty() ? E.Name : E.SymbolName; ImportNameType NameType = getNameType(SymbolName, E.Name, Machine); Expected Name = E.ExtName.empty() ? SymbolName diff --git a/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp b/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp index 005f2d51e403..9a7f45bde6c9 100644 --- a/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp +++ b/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp @@ -388,6 +388,10 @@ static unsigned isMatchingStore(MachineInstr &LoadInst, } static unsigned getPreIndexedOpcode(unsigned Opc) { + // FIXME: We don't currently support creating pre-indexed loads/stores when + // the load or store is the unscaled version. If we decide to perform such an + // optimization in the future the cases for the unscaled loads/stores will + // need to be added here. switch (Opc) { default: llvm_unreachable("Opcode has no pre-indexed equivalent!"); @@ -451,32 +455,42 @@ static unsigned getPostIndexedOpcode(unsigned Opc) { default: llvm_unreachable("Opcode has no post-indexed wise equivalent!"); case AArch64::STRSui: + case AArch64::STURSi: return AArch64::STRSpost; case AArch64::STRDui: + case AArch64::STURDi: return AArch64::STRDpost; case AArch64::STRQui: + case AArch64::STURQi: return AArch64::STRQpost; case AArch64::STRBBui: return AArch64::STRBBpost; case AArch64::STRHHui: return AArch64::STRHHpost; case AArch64::STRWui: + case AArch64::STURWi: return AArch64::STRWpost; case AArch64::STRXui: + case AArch64::STURXi: return AArch64::STRXpost; case AArch64::LDRSui: + case AArch64::LDURSi: return AArch64::LDRSpost; case AArch64::LDRDui: + case AArch64::LDURDi: return AArch64::LDRDpost; case AArch64::LDRQui: + case AArch64::LDURQi: return AArch64::LDRQpost; case AArch64::LDRBBui: return AArch64::LDRBBpost; case AArch64::LDRHHui: return AArch64::LDRHHpost; case AArch64::LDRWui: + case AArch64::LDURWi: return AArch64::LDRWpost; case AArch64::LDRXui: + case AArch64::LDURXi: return AArch64::LDRXpost; case AArch64::LDRSWui: return AArch64::LDRSWpost; @@ -1694,8 +1708,9 @@ bool AArch64LoadStoreOpt::optimizeBlock(MachineBasicBlock &MBB, ++NumPostFolded; break; } - // Don't know how to handle pre/post-index versions, so move to the next - // instruction. + + // Don't know how to handle unscaled pre/post-index versions below, so + // move to the next instruction. if (TII->isUnscaledLdSt(Opc)) { ++MBBI; break; diff --git a/lib/Target/ARM/ARMExpandPseudoInsts.cpp b/lib/Target/ARM/ARMExpandPseudoInsts.cpp index ec49f0d37af4..46d8f0dba691 100644 --- a/lib/Target/ARM/ARMExpandPseudoInsts.cpp +++ b/lib/Target/ARM/ARMExpandPseudoInsts.cpp @@ -769,8 +769,7 @@ bool ARMExpandPseudo::ExpandCMP_SWAP(MachineBasicBlock &MBB, MachineInstr &MI = *MBBI; DebugLoc DL = MI.getDebugLoc(); const MachineOperand &Dest = MI.getOperand(0); - unsigned StatusReg = MI.getOperand(1).getReg(); - bool StatusDead = MI.getOperand(1).isDead(); + unsigned TempReg = MI.getOperand(1).getReg(); // Duplicating undef operands into 2 instructions does not guarantee the same // value on both; However undef should be replaced by xzr anyway. assert(!MI.getOperand(2).isUndef() && "cannot handle undef"); @@ -797,23 +796,9 @@ bool ARMExpandPseudo::ExpandCMP_SWAP(MachineBasicBlock &MBB, } // .Lloadcmp: - // mov wStatus, #0 // ldrex rDest, [rAddr] // cmp rDest, rDesired // bne .Ldone - if (!StatusDead) { - if (IsThumb) { - BuildMI(LoadCmpBB, DL, TII->get(ARM::tMOVi8), StatusReg) - .addDef(ARM::CPSR, RegState::Dead) - .addImm(0) - .add(predOps(ARMCC::AL)); - } else { - BuildMI(LoadCmpBB, DL, TII->get(ARM::MOVi), StatusReg) - .addImm(0) - .add(predOps(ARMCC::AL)) - .add(condCodeOp()); - } - } MachineInstrBuilder MIB; MIB = BuildMI(LoadCmpBB, DL, TII->get(LdrexOp), Dest.getReg()); @@ -836,10 +821,10 @@ bool ARMExpandPseudo::ExpandCMP_SWAP(MachineBasicBlock &MBB, LoadCmpBB->addSuccessor(StoreBB); // .Lstore: - // strex rStatus, rNew, [rAddr] - // cmp rStatus, #0 + // strex rTempReg, rNew, [rAddr] + // cmp rTempReg, #0 // bne .Lloadcmp - MIB = BuildMI(StoreBB, DL, TII->get(StrexOp), StatusReg) + MIB = BuildMI(StoreBB, DL, TII->get(StrexOp), TempReg) .addReg(NewReg) .addReg(AddrReg); if (StrexOp == ARM::t2STREX) @@ -848,7 +833,7 @@ bool ARMExpandPseudo::ExpandCMP_SWAP(MachineBasicBlock &MBB, unsigned CMPri = IsThumb ? ARM::t2CMPri : ARM::CMPri; BuildMI(StoreBB, DL, TII->get(CMPri)) - .addReg(StatusReg, getKillRegState(StatusDead)) + .addReg(TempReg, RegState::Kill) .addImm(0) .add(predOps(ARMCC::AL)); BuildMI(StoreBB, DL, TII->get(Bcc)) @@ -904,8 +889,7 @@ bool ARMExpandPseudo::ExpandCMP_SWAP_64(MachineBasicBlock &MBB, MachineInstr &MI = *MBBI; DebugLoc DL = MI.getDebugLoc(); MachineOperand &Dest = MI.getOperand(0); - unsigned StatusReg = MI.getOperand(1).getReg(); - bool StatusDead = MI.getOperand(1).isDead(); + unsigned TempReg = MI.getOperand(1).getReg(); // Duplicating undef operands into 2 instructions does not guarantee the same // value on both; However undef should be replaced by xzr anyway. assert(!MI.getOperand(2).isUndef() && "cannot handle undef"); @@ -931,7 +915,7 @@ bool ARMExpandPseudo::ExpandCMP_SWAP_64(MachineBasicBlock &MBB, // .Lloadcmp: // ldrexd rDestLo, rDestHi, [rAddr] // cmp rDestLo, rDesiredLo - // sbcs rStatus, rDestHi, rDesiredHi + // sbcs rTempReg, rDestHi, rDesiredHi // bne .Ldone unsigned LDREXD = IsThumb ? ARM::t2LDREXD : ARM::LDREXD; MachineInstrBuilder MIB; @@ -959,17 +943,17 @@ bool ARMExpandPseudo::ExpandCMP_SWAP_64(MachineBasicBlock &MBB, LoadCmpBB->addSuccessor(StoreBB); // .Lstore: - // strexd rStatus, rNewLo, rNewHi, [rAddr] - // cmp rStatus, #0 + // strexd rTempReg, rNewLo, rNewHi, [rAddr] + // cmp rTempReg, #0 // bne .Lloadcmp unsigned STREXD = IsThumb ? ARM::t2STREXD : ARM::STREXD; - MIB = BuildMI(StoreBB, DL, TII->get(STREXD), StatusReg); + MIB = BuildMI(StoreBB, DL, TII->get(STREXD), TempReg); addExclusiveRegPair(MIB, New, 0, IsThumb, TRI); MIB.addReg(AddrReg).add(predOps(ARMCC::AL)); unsigned CMPri = IsThumb ? ARM::t2CMPri : ARM::CMPri; BuildMI(StoreBB, DL, TII->get(CMPri)) - .addReg(StatusReg, getKillRegState(StatusDead)) + .addReg(TempReg, RegState::Kill) .addImm(0) .add(predOps(ARMCC::AL)); BuildMI(StoreBB, DL, TII->get(Bcc)) diff --git a/lib/Target/ARM/ARMInstrInfo.td b/lib/Target/ARM/ARMInstrInfo.td index d06b7d0896f1..7206083a7079 100644 --- a/lib/Target/ARM/ARMInstrInfo.td +++ b/lib/Target/ARM/ARMInstrInfo.td @@ -6053,21 +6053,21 @@ def SPACE : PseudoInst<(outs GPR:$Rd), (ins i32imm:$size, GPR:$Rn), // significantly more naive than the standard expansion: we conservatively // assume seq_cst, strong cmpxchg and omit clrex on failure. -let Constraints = "@earlyclobber $Rd,@earlyclobber $status", +let Constraints = "@earlyclobber $Rd,@earlyclobber $temp", mayLoad = 1, mayStore = 1 in { -def CMP_SWAP_8 : PseudoInst<(outs GPR:$Rd, GPR:$status), +def CMP_SWAP_8 : PseudoInst<(outs GPR:$Rd, GPR:$temp), (ins GPR:$addr, GPR:$desired, GPR:$new), NoItinerary, []>, Sched<[]>; -def CMP_SWAP_16 : PseudoInst<(outs GPR:$Rd, GPR:$status), +def CMP_SWAP_16 : PseudoInst<(outs GPR:$Rd, GPR:$temp), (ins GPR:$addr, GPR:$desired, GPR:$new), NoItinerary, []>, Sched<[]>; -def CMP_SWAP_32 : PseudoInst<(outs GPR:$Rd, GPR:$status), +def CMP_SWAP_32 : PseudoInst<(outs GPR:$Rd, GPR:$temp), (ins GPR:$addr, GPR:$desired, GPR:$new), NoItinerary, []>, Sched<[]>; -def CMP_SWAP_64 : PseudoInst<(outs GPRPair:$Rd, GPR:$status), +def CMP_SWAP_64 : PseudoInst<(outs GPRPair:$Rd, GPR:$temp), (ins GPR:$addr, GPRPair:$desired, GPRPair:$new), NoItinerary, []>, Sched<[]>; } diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index 7563bffd8f87..1e73122cdc38 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -419,6 +419,11 @@ X86TargetLowering::X86TargetLowering(const X86TargetMachine &TM, setOperationAction(ISD::SELECT, VT, Custom); setOperationAction(ISD::SETCC, VT, Custom); } + + // Custom action for SELECT MMX and expand action for SELECT_CC MMX + setOperationAction(ISD::SELECT, MVT::x86mmx, Custom); + setOperationAction(ISD::SELECT_CC, MVT::x86mmx, Expand); + setOperationAction(ISD::EH_RETURN , MVT::Other, Custom); // NOTE: EH_SJLJ_SETJMP/_LONGJMP supported here is NOT intended to support // SjLj exception handling but a light-weight setjmp/longjmp replacement to @@ -1383,7 +1388,7 @@ X86TargetLowering::X86TargetLowering(const X86TargetMachine &TM, // (result) is 256-bit but the source is 512-bit wide. // 128-bit was made Custom under AVX1. for (auto VT : { MVT::v32i8, MVT::v16i16, MVT::v8i32, MVT::v4i64, - MVT::v8f32, MVT::v4f64 }) + MVT::v8f32, MVT::v4f64, MVT::v1i1 }) setOperationAction(ISD::EXTRACT_SUBVECTOR, VT, Custom); for (auto VT : { MVT::v2i1, MVT::v4i1, MVT::v8i1, MVT::v16i1, MVT::v32i1, MVT::v64i1 }) @@ -14570,6 +14575,21 @@ static SDValue LowerEXTRACT_SUBVECTOR(SDValue Op, const X86Subtarget &Subtarget, unsigned IdxVal = cast(Idx)->getZExtValue(); MVT ResVT = Op.getSimpleValueType(); + // When v1i1 is legal a scalarization of a vselect with a vXi1 Cond + // would result with: v1i1 = extract_subvector(vXi1, idx). + // Lower these into extract_vector_elt which is already selectable. + if (ResVT == MVT::v1i1) { + assert(Subtarget.hasAVX512() && + "Boolean EXTRACT_SUBVECTOR requires AVX512"); + + MVT EltVT = ResVT.getVectorElementType(); + const TargetLowering &TLI = DAG.getTargetLoweringInfo(); + MVT LegalVT = + (TLI.getTypeToTransformTo(*DAG.getContext(), EltVT)).getSimpleVT(); + SDValue Res = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, LegalVT, In, Idx); + return DAG.getNode(ISD::SCALAR_TO_VECTOR, dl, ResVT, Res); + } + assert((In.getSimpleValueType().is256BitVector() || In.getSimpleValueType().is512BitVector()) && "Can only extract from 256-bit or 512-bit vectors"); @@ -20651,8 +20671,8 @@ static SDValue LowerINTRINSIC_W_CHAIN(SDValue Op, const X86Subtarget &Subtarget, } // ADC/ADCX/SBB case ADX: { - SDVTList CFVTs = DAG.getVTList(Op->getValueType(0), MVT::Other); - SDVTList VTs = DAG.getVTList(Op.getOperand(3)->getValueType(0), MVT::Other); + SDVTList CFVTs = DAG.getVTList(Op->getValueType(0), MVT::i32); + SDVTList VTs = DAG.getVTList(Op.getOperand(3)->getValueType(0), MVT::i32); SDValue GenCF = DAG.getNode(X86ISD::ADD, dl, CFVTs, Op.getOperand(2), DAG.getConstant(-1, dl, MVT::i8)); SDValue Res = DAG.getNode(IntrData->Opc0, dl, VTs, Op.getOperand(3), @@ -30663,6 +30683,14 @@ static SDValue combineSelect(SDNode *N, SelectionDAG &DAG, return SDValue(N, 0); } + // Custom action for SELECT MMX + if (VT == MVT::x86mmx) { + LHS = DAG.getBitcast(MVT::i64, LHS); + RHS = DAG.getBitcast(MVT::i64, RHS); + SDValue newSelect = DAG.getNode(ISD::SELECT, DL, MVT::i64, Cond, LHS, RHS); + return DAG.getBitcast(VT, newSelect); + } + return SDValue(); } @@ -33358,7 +33386,8 @@ static SDValue combineStore(SDNode *N, SelectionDAG &DAG, SDValue NewLd = DAG.getLoad(LdVT, LdDL, Ld->getChain(), Ld->getBasePtr(), Ld->getPointerInfo(), Ld->getAlignment(), Ld->getMemOperand()->getFlags()); - SDValue NewChain = NewLd.getValue(1); + // Make sure new load is placed in same chain order. + SDValue NewChain = DAG.makeEquivalentMemoryOrdering(Ld, NewLd); if (TokenFactorIndex >= 0) { Ops.push_back(NewChain); NewChain = DAG.getNode(ISD::TokenFactor, LdDL, MVT::Other, Ops); @@ -33379,11 +33408,12 @@ static SDValue combineStore(SDNode *N, SelectionDAG &DAG, Ld->getPointerInfo().getWithOffset(4), MinAlign(Ld->getAlignment(), 4), Ld->getMemOperand()->getFlags()); + // Make sure new loads are placed in same chain order. + SDValue NewChain = DAG.makeEquivalentMemoryOrdering(Ld, LoLd); + NewChain = DAG.makeEquivalentMemoryOrdering(Ld, HiLd); - SDValue NewChain = LoLd.getValue(1); if (TokenFactorIndex >= 0) { - Ops.push_back(LoLd); - Ops.push_back(HiLd); + Ops.push_back(NewChain); NewChain = DAG.getNode(ISD::TokenFactor, LdDL, MVT::Other, Ops); } diff --git a/lib/Target/X86/X86InstrAVX512.td b/lib/Target/X86/X86InstrAVX512.td index 705d0f7a5cf7..0e654a380e7c 100644 --- a/lib/Target/X86/X86InstrAVX512.td +++ b/lib/Target/X86/X86InstrAVX512.td @@ -978,6 +978,44 @@ multiclass avx512_int_broadcast_reg opc, X86VectorVTInfo _, (_.VT (OpNode SrcRC:$src))>, T8PD, EVEX; } +multiclass avx512_int_broadcastbw_reg opc, string Name, + X86VectorVTInfo _, SDPatternOperator OpNode, + RegisterClass SrcRC, SubRegIndex Subreg> { + let ExeDomain = _.ExeDomain in + defm r : AVX512_maskable_custom, T8PD, EVEX; + + def : Pat <(_.VT (OpNode SrcRC:$src)), + (!cast(Name#r) + (i32 (INSERT_SUBREG (i32 (IMPLICIT_DEF)), SrcRC:$src, Subreg)))>; + + def : Pat <(vselect _.KRCWM:$mask, (_.VT (OpNode SrcRC:$src)), _.RC:$src0), + (!cast(Name#rk) _.RC:$src0, _.KRCWM:$mask, + (i32 (INSERT_SUBREG (i32 (IMPLICIT_DEF)), SrcRC:$src, Subreg)))>; + + def : Pat <(vselect _.KRCWM:$mask, (_.VT (OpNode SrcRC:$src)), _.ImmAllZerosV), + (!cast(Name#rkz) _.KRCWM:$mask, + (i32 (INSERT_SUBREG (i32 (IMPLICIT_DEF)), SrcRC:$src, Subreg)))>; +} + +multiclass avx512_int_broadcastbw_reg_vl opc, string Name, + AVX512VLVectorVTInfo _, SDPatternOperator OpNode, + RegisterClass SrcRC, SubRegIndex Subreg, Predicate prd> { + let Predicates = [prd] in + defm Z : avx512_int_broadcastbw_reg, EVEX_V512; + let Predicates = [prd, HasVLX] in { + defm Z256 : avx512_int_broadcastbw_reg, EVEX_V256; + defm Z128 : avx512_int_broadcastbw_reg, EVEX_V128; + } +} + multiclass avx512_int_broadcast_reg_vl opc, AVX512VLVectorVTInfo _, SDPatternOperator OpNode, RegisterClass SrcRC, Predicate prd> { @@ -989,18 +1027,11 @@ multiclass avx512_int_broadcast_reg_vl opc, AVX512VLVectorVTInfo _, } } -let isCodeGenOnly = 1 in { -defm VPBROADCASTBr : avx512_int_broadcast_reg_vl<0x7A, avx512vl_i8_info, - X86VBroadcast, GR8, HasBWI>; -defm VPBROADCASTWr : avx512_int_broadcast_reg_vl<0x7B, avx512vl_i16_info, - X86VBroadcast, GR16, HasBWI>; -} -let isAsmParserOnly = 1 in { - defm VPBROADCASTBr_Alt : avx512_int_broadcast_reg_vl<0x7A, avx512vl_i8_info, - null_frag, GR32, HasBWI>; - defm VPBROADCASTWr_Alt : avx512_int_broadcast_reg_vl<0x7B, avx512vl_i16_info, - null_frag, GR32, HasBWI>; -} +defm VPBROADCASTBr : avx512_int_broadcastbw_reg_vl<0x7A, "VPBROADCASTBr", + avx512vl_i8_info, X86VBroadcast, GR8, sub_8bit, HasBWI>; +defm VPBROADCASTWr : avx512_int_broadcastbw_reg_vl<0x7B, "VPBROADCASTWr", + avx512vl_i16_info, X86VBroadcast, GR16, sub_16bit, + HasBWI>; defm VPBROADCASTDr : avx512_int_broadcast_reg_vl<0x7C, avx512vl_i32_info, X86VBroadcast, GR32, HasAVX512>; defm VPBROADCASTQr : avx512_int_broadcast_reg_vl<0x7C, avx512vl_i64_info, diff --git a/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp b/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp index a7de79306074..fc15dc1e6032 100644 --- a/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp +++ b/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp @@ -60,11 +60,13 @@ std::vector> OwningMBs; // Opens a file. Path has to be resolved already. // Newly created memory buffers are owned by this driver. -MemoryBufferRef openFile(StringRef Path) { +Optional openFile(StringRef Path) { ErrorOr> MB = MemoryBuffer::getFile(Path); - if (std::error_code EC = MB.getError()) + if (std::error_code EC = MB.getError()) { llvm::errs() << "fail openFile: " << EC.message() << "\n"; + return None; + } MemoryBufferRef MBRef = MB.get()->getMemBufferRef(); OwningMBs.push_back(std::move(MB.get())); // take ownership @@ -114,11 +116,16 @@ int llvm::dlltoolDriverMain(llvm::ArrayRef ArgsArr) { for (auto *Arg : Args.filtered(OPT_UNKNOWN)) llvm::errs() << "ignoring unknown argument: " << Arg->getSpelling() << "\n"; - MemoryBufferRef MB; - if (auto *Arg = Args.getLastArg(OPT_d)) - MB = openFile(Arg->getValue()); + if (!Args.hasArg(OPT_d)) { + llvm::errs() << "no definition file specified\n"; + return 1; + } - if (!MB.getBufferSize()) { + Optional MB = openFile(Args.getLastArg(OPT_d)->getValue()); + if (!MB) + return 1; + + if (!MB->getBufferSize()) { llvm::errs() << "definition file empty\n"; return 1; } @@ -133,7 +140,7 @@ int llvm::dlltoolDriverMain(llvm::ArrayRef ArgsArr) { } Expected Def = - parseCOFFModuleDefinition(MB, Machine, true); + parseCOFFModuleDefinition(*MB, Machine, true); if (!Def) { llvm::errs() << "error parsing definition\n" @@ -154,7 +161,7 @@ int llvm::dlltoolDriverMain(llvm::ArrayRef ArgsArr) { if (Path.empty()) Path = getImplibPath(Def->OutputFile); - if (writeImportLibrary(Def->OutputFile, Path, Def->Exports, Machine)) + if (writeImportLibrary(Def->OutputFile, Path, Def->Exports, Machine, true)) return 1; return 0; } diff --git a/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp b/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp index a33490f6e4ac..ddc975cbed1a 100644 --- a/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp +++ b/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp @@ -1470,6 +1470,7 @@ void DFSanVisitor::visitCallSite(CallSite CS) { } i = CS.arg_begin(); + const unsigned ShadowArgStart = Args.size(); for (unsigned n = FT->getNumParams(); n != 0; ++i, --n) Args.push_back(DFSF.getShadow(*i)); @@ -1505,6 +1506,15 @@ void DFSanVisitor::visitCallSite(CallSite CS) { CustomCI->setCallingConv(CI->getCallingConv()); CustomCI->setAttributes(CI->getAttributes()); + // Update the parameter attributes of the custom call instruction to + // zero extend the shadow parameters. This is required for targets + // which consider ShadowTy an illegal type. + for (unsigned n = 0; n < FT->getNumParams(); n++) { + const unsigned ArgNo = ShadowArgStart + n; + if (CustomCI->getArgOperand(ArgNo)->getType() == DFSF.DFS.ShadowTy) + CustomCI->addParamAttr(ArgNo, Attribute::ZExt); + } + if (!FT->getReturnType()->isVoidTy()) { LoadInst *LabelLoad = IRB.CreateLoad(DFSF.LabelReturnAlloca); DFSF.setShadow(CustomCI, LabelLoad); diff --git a/lib/Transforms/Scalar/BDCE.cpp b/lib/Transforms/Scalar/BDCE.cpp index 61e8700f1cd6..2e5618686ec2 100644 --- a/lib/Transforms/Scalar/BDCE.cpp +++ b/lib/Transforms/Scalar/BDCE.cpp @@ -15,6 +15,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Transforms/Scalar/BDCE.h" +#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Statistic.h" #include "llvm/Analysis/DemandedBits.h" @@ -35,6 +36,46 @@ using namespace llvm; STATISTIC(NumRemoved, "Number of instructions removed (unused)"); STATISTIC(NumSimplified, "Number of instructions trivialized (dead bits)"); +/// If an instruction is trivialized (dead), then the chain of users of that +/// instruction may need to be cleared of assumptions that can no longer be +/// guaranteed correct. +static void clearAssumptionsOfUsers(Instruction *I, DemandedBits &DB) { + assert(I->getType()->isIntegerTy() && "Trivializing a non-integer value?"); + + // Initialize the worklist with eligible direct users. + SmallVector WorkList; + for (User *JU : I->users()) { + // If all bits of a user are demanded, then we know that nothing below that + // in the def-use chain needs to be changed. + auto *J = dyn_cast(JU); + if (J && !DB.getDemandedBits(J).isAllOnesValue()) + WorkList.push_back(J); + } + + // DFS through subsequent users while tracking visits to avoid cycles. + SmallPtrSet Visited; + while (!WorkList.empty()) { + Instruction *J = WorkList.pop_back_val(); + + // NSW, NUW, and exact are based on operands that might have changed. + J->dropPoisonGeneratingFlags(); + + // We do not have to worry about llvm.assume or range metadata: + // 1. llvm.assume demands its operand, so trivializing can't change it. + // 2. range metadata only applies to memory accesses which demand all bits. + + Visited.insert(J); + + for (User *KU : J->users()) { + // If all bits of a user are demanded, then we know that nothing below + // that in the def-use chain needs to be changed. + auto *K = dyn_cast(KU); + if (K && !Visited.count(K) && !DB.getDemandedBits(K).isAllOnesValue()) + WorkList.push_back(K); + } + } +} + static bool bitTrackingDCE(Function &F, DemandedBits &DB) { SmallVector Worklist; bool Changed = false; @@ -51,6 +92,9 @@ static bool bitTrackingDCE(Function &F, DemandedBits &DB) { // replacing all uses with something else. Then, if they don't need to // remain live (because they have side effects, etc.) we can remove them. DEBUG(dbgs() << "BDCE: Trivializing: " << I << " (all bits dead)\n"); + + clearAssumptionsOfUsers(&I, DB); + // FIXME: In theory we could substitute undef here instead of zero. // This should be reconsidered once we settle on the semantics of // undef, poison, etc. diff --git a/test/Analysis/ScalarEvolution/max-addrec-size.ll b/test/Analysis/ScalarEvolution/max-addrec-size.ll new file mode 100644 index 000000000000..aad0ddda37bc --- /dev/null +++ b/test/Analysis/ScalarEvolution/max-addrec-size.ll @@ -0,0 +1,33 @@ +; RUN: opt -analyze -scalar-evolution -scalar-evolution-max-add-rec-size=3 < %s | FileCheck %s + +; Show that we are able to avoid creation of huge SCEVs by capping the max +; AddRec size. +define i32 @test_01(i32 %a, i32 %b) { + +; CHECK-LABEL: Classifying expressions for: @test_01 +; CHECK-NEXT: %iv = phi i32 [ %a, %entry ], [ %iv.next, %loop ] +; CHECK-NEXT: --> {%a,+,%b}<%loop> U: full-set S: full-set +; CHECK-NEXT: %iv.next = add i32 %iv, %b +; CHECK-NEXT: --> {(%a + %b),+,%b}<%loop> U: full-set S: full-set +; CHECK-NEXT: %x1 = mul i32 %iv, %iv.next +; CHECK-NEXT: --> {((%a + %b) * %a),+,(((2 * %a) + (2 * %b)) * %b),+,(2 * %b * %b)}<%loop> U: full-set S: full-set +; CHECK-NEXT: %x2 = mul i32 %x1, %x1 +; CHECK-NEXT: --> ({((%a + %b) * %a),+,(((2 * %a) + (2 * %b)) * %b),+,(2 * %b * %b)}<%loop> * {((%a + %b) * %a),+,(((2 * %a) + (2 * %b)) * %b),+,(2 * %b * %b)}<%loop>) U: full-set S: full-set +; CHECK-NEXT: %x3 = mul i32 %x2, %x1 +; CHECK-NEXT: --> ({((%a + %b) * %a),+,(((2 * %a) + (2 * %b)) * %b),+,(2 * %b * %b)}<%loop> * {((%a + %b) * %a),+,(((2 * %a) + (2 * %b)) * %b),+,(2 * %b * %b)}<%loop> * {((%a + %b) * %a),+,(((2 * %a) + (2 * %b)) * %b),+,(2 * %b * %b)}<%loop>) U: full-set S: full-set + +entry: + br label %loop + +loop: + %iv = phi i32 [ %a, %entry ], [ %iv.next, %loop ] + %iv.next = add i32 %iv, %b + %cond = icmp slt i32 %iv.next, 1000 + br i1 %cond, label %loop, label %exit + +exit: + %x1 = mul i32 %iv, %iv.next + %x2 = mul i32 %x1, %x1 + %x3 = mul i32 %x2, %x1 + ret i32 %x3 +} diff --git a/test/CodeGen/AArch64/arm64-ldst-unscaled-pre-post.mir b/test/CodeGen/AArch64/arm64-ldst-unscaled-pre-post.mir new file mode 100644 index 000000000000..dacaf4966d07 --- /dev/null +++ b/test/CodeGen/AArch64/arm64-ldst-unscaled-pre-post.mir @@ -0,0 +1,115 @@ +# RUN: llc -mtriple=aarch64-none-linux-gnu -run-pass aarch64-ldst-opt -verify-machineinstrs -o - %s | FileCheck %s +--- +# CHECK-LABEL: name: test_LDURSi_post +# CHECK: LDRSpost %x0, -4 +name: test_LDURSi_post +body: | + bb.0.entry: + liveins: %x0 + + %s0 = LDURSi %x0, 0 + %x0 = SUBXri %x0, 4, 0 + RET_ReallyLR implicit %x0 +... +# CHECK-LABEL: name: test_LDURDi_post +# CHECK: LDRDpost %x0, -4 +name: test_LDURDi_post +body: | + bb.0.entry: + liveins: %x0 + + %d0 = LDURDi %x0, 0 + %x0 = SUBXri %x0, 4, 0 + RET_ReallyLR implicit %x0 +... +# CHECK-LABEL: name: test_LDURQi_post +# CHECK: LDRQpost %x0, -4 +name: test_LDURQi_post +body: | + bb.0.entry: + liveins: %x0 + + %q0 = LDURQi %x0, 0 + %x0 = SUBXri %x0, 4, 0 + RET_ReallyLR implicit %x0 +... +# CHECK-LABEL: name: test_LDURWi_post +# CHECK: LDRWpost %x0, -4 +name: test_LDURWi_post +body: | + bb.0.entry: + liveins: %x0 + + %w1 = LDURWi %x0, 0 + %x0 = SUBXri %x0, 4, 0 + RET_ReallyLR implicit %x0 +... +# CHECK-LABEL: name: test_LDURXi_post +# CHECK: %x1 = LDRXpost %x0, -4 +name: test_LDURXi_post +body: | + bb.0.entry: + liveins: %x0 + + %x1 = LDURXi %x0, 0 + %x0 = SUBXri %x0, 4, 0 + RET_ReallyLR implicit %x0 +... +# CHECK-LABEL: name: test_STURSi_post +# CHECK: STRSpost %s0, %x0, -4 +name: test_STURSi_post +body: | + bb.0.entry: + liveins: %x0 + + %s0 = FMOVS0 + STURSi %s0, %x0, 0 + %x0 = SUBXri %x0, 4, 0 + RET_ReallyLR implicit %x0 +... +# CHECK-LABEL: name: test_STURDi_post +# CHECK: STRDpost %d0, %x0, -4 +name: test_STURDi_post +body: | + bb.0.entry: + liveins: %x0 + + %d0 = FMOVD0 + STURDi %d0, %x0, 0 + %x0 = SUBXri %x0, 4, 0 + RET_ReallyLR implicit %x0 +... +# CHECK-LABEL: name: test_STURQi_post +# CHECK: STRQpost %q0, %x0, -4 +name: test_STURQi_post +body: | + bb.0.entry: + liveins: %x0 + + %q0 = MOVIv4i32 0, 0 + STURQi %q0, %x0, 0 + %x0 = SUBXri %x0, 4, 0 + RET_ReallyLR implicit %x0 +... +# CHECK-LABEL: name: test_STURWi_post +# CHECK: STRWpost %wzr, %x0, -4 +name: test_STURWi_post +body: | + bb.0.entry: + liveins: %x0 + + STURWi %wzr, %x0, 0 + %x0 = SUBXri %x0, 4, 0 + RET_ReallyLR implicit %x0 +... +# CHECK-LABEL: name: test_STURXi_post +# CHECK: STRXpost %xzr, %x0, -4 +name: test_STURXi_post +body: | + bb.0.entry: + liveins: %x0 + + STURXi %xzr, %x0, 0 + %x0 = SUBXri %x0, 4, 0 + RET_ReallyLR implicit %x0 +... diff --git a/test/CodeGen/ARM/cmpxchg-O0.ll b/test/CodeGen/ARM/cmpxchg-O0.ll index a3be72112c76..f8ad2bbbbe0e 100644 --- a/test/CodeGen/ARM/cmpxchg-O0.ll +++ b/test/CodeGen/ARM/cmpxchg-O0.ll @@ -10,11 +10,10 @@ define { i8, i1 } @test_cmpxchg_8(i8* %addr, i8 %desired, i8 %new) nounwind { ; CHECK: dmb ish ; CHECK: uxtb [[DESIRED:r[0-9]+]], [[DESIRED]] ; CHECK: [[RETRY:.LBB[0-9]+_[0-9]+]]: -; CHECK: mov{{s?}} [[STATUS:r[0-9]+]], #0 ; CHECK: ldrexb [[OLD:r[0-9]+]], [r0] ; CHECK: cmp [[OLD]], [[DESIRED]] ; CHECK: bne [[DONE:.LBB[0-9]+_[0-9]+]] -; CHECK: strexb [[STATUS]], r2, [r0] +; CHECK: strexb [[STATUS:r[0-9]+]], r2, [r0] ; CHECK: cmp{{(\.w)?}} [[STATUS]], #0 ; CHECK: bne [[RETRY]] ; CHECK: [[DONE]]: @@ -30,11 +29,10 @@ define { i16, i1 } @test_cmpxchg_16(i16* %addr, i16 %desired, i16 %new) nounwind ; CHECK: dmb ish ; CHECK: uxth [[DESIRED:r[0-9]+]], [[DESIRED]] ; CHECK: [[RETRY:.LBB[0-9]+_[0-9]+]]: -; CHECK: mov{{s?}} [[STATUS:r[0-9]+]], #0 ; CHECK: ldrexh [[OLD:r[0-9]+]], [r0] ; CHECK: cmp [[OLD]], [[DESIRED]] ; CHECK: bne [[DONE:.LBB[0-9]+_[0-9]+]] -; CHECK: strexh [[STATUS]], r2, [r0] +; CHECK: strexh [[STATUS:r[0-9]+]], r2, [r0] ; CHECK: cmp{{(\.w)?}} [[STATUS]], #0 ; CHECK: bne [[RETRY]] ; CHECK: [[DONE]]: @@ -50,11 +48,10 @@ define { i32, i1 } @test_cmpxchg_32(i32* %addr, i32 %desired, i32 %new) nounwind ; CHECK: dmb ish ; CHECK-NOT: uxt ; CHECK: [[RETRY:.LBB[0-9]+_[0-9]+]]: -; CHECK: mov{{s?}} [[STATUS:r[0-9]+]], #0 ; CHECK: ldrex [[OLD:r[0-9]+]], [r0] ; CHECK: cmp [[OLD]], [[DESIRED]] ; CHECK: bne [[DONE:.LBB[0-9]+_[0-9]+]] -; CHECK: strex [[STATUS]], r2, [r0] +; CHECK: strex [[STATUS:r[0-9]+]], r2, [r0] ; CHECK: cmp{{(\.w)?}} [[STATUS]], #0 ; CHECK: bne [[RETRY]] ; CHECK: [[DONE]]: diff --git a/test/CodeGen/ARM/virtregrewriter-subregliveness.mir b/test/CodeGen/ARM/virtregrewriter-subregliveness.mir new file mode 100644 index 000000000000..83335a3ccffd --- /dev/null +++ b/test/CodeGen/ARM/virtregrewriter-subregliveness.mir @@ -0,0 +1,84 @@ +# RUN: llc -o - -mtriple=thumbv7--windows-gnu -run-pass=greedy -run-pass=virtregrewriter %s | FileCheck %s +--- | + target datalayout = "e-m:w-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" + target triple = "thumbv7--windows-gnu" + + define void @subregLiveThrough() { ret void } + define void @subregNotLiveThrough() { ret void } + define void @subregNotLiveThrough2() { ret void } + +... +--- +# Check that we properly recognize that r1 is live through +# the first subreg copy. +# That will materialize as an implicit use of the big register +# on that copy. +# PR34107. +# +# CHECK-LABEL: name: subregLiveThrough +name: subregLiveThrough +tracksRegLiveness: true +registers: + - { id: 0, class: gprpair } +body: | + bb.0: + liveins: %r0, %r1 + + ; That copy is being coalesced so we should use a KILL + ; placeholder. If that's not a kill that means we probably + ; not coalescing %0 and %r0_r1 and thus we are not testing + ; the problematic code anymore. + ; + ; CHECK: %r0 = KILL %r0, implicit killed %r0_r1, implicit-def %r0_r1 + ; CHECK-NEXT: %r1 = KILL %r1, implicit killed %r0_r1 + undef %0.gsub_0 = COPY %r0 + %0.gsub_1 = COPY %r1 + tBX_RET 14, _, implicit %0 + + +... + +--- +# Check that we properly recognize that r1 is *not* live through +# the first subreg copy. +# CHECK-LABEL: name: subregNotLiveThrough +name: subregNotLiveThrough +tracksRegLiveness: true +registers: + - { id: 0, class: gprpair } +body: | + bb.0: + liveins: %r0, %r1 + + ; r1 is not live through so check we are not implicitly using + ; the big register. + ; CHECK: %r0 = KILL %r0, implicit-def %r0_r1 + ; CHECK-NEXT: tBX_RET + undef %0.gsub_0 = COPY %r0 + tBX_RET 14, _, implicit %0 + + +... + +--- +# Check that we properly recognize that r1 is *not* live through +# the first subreg copy. It is defined by this copy, but is not +# through. +# CHECK-LABEL: name: subregNotLiveThrough2 +name: subregNotLiveThrough2 +tracksRegLiveness: true +registers: + - { id: 0, class: gprpair } +body: | + bb.0: + liveins: %r0, %r1 + + ; r1 is not live through so check we are not implicitly using + ; the big register. + ; CHECK: %r0 = KILL %r0, implicit-def %r1, implicit-def %r0_r1 + ; CHECK-NEXT: tBX_RET + undef %0.gsub_0 = COPY %r0, implicit-def %r1 + tBX_RET 14, _, implicit %0 + + +... diff --git a/test/CodeGen/X86/adx-intrinsics.ll b/test/CodeGen/X86/adx-intrinsics.ll index 0498177a9c12..819a5df14e63 100644 --- a/test/CodeGen/X86/adx-intrinsics.ll +++ b/test/CodeGen/X86/adx-intrinsics.ll @@ -75,3 +75,30 @@ define i8 @test_subborrow_u64(i8 %c, i64 %a, i64 %b, i8* %ptr) { ret i8 %ret; } +; Try a version with loads. Previously we crashed on this. +define i32 @load_crash(i64* nocapture readonly %a, i64* nocapture readonly %b, i64* %res) { +; CHECK-LABEL: load_crash +; CHECK: addb +; ADX: adcxq +; CHECK: setb +; CHECK: retq + %1 = load i64, i64* %a, align 8 + %2 = load i64, i64* %b, align 8 + %3 = bitcast i64* %res to i8* + %4 = tail call i8 @llvm.x86.addcarryx.u64(i8 0, i64 %1, i64 %2, i8* %3) + %conv = zext i8 %4 to i32 + ret i32 %conv +} + +; Try a really simple all zero input case, which also used to crash +define void @allzeros() { +; CHECK-LABEL: allzeros +; CHECK: xorl +; CHECK: addb +; CHECK: sbbq +; CHECK: andl +; CHECK: retq +entry: + %0 = tail call i8 @llvm.x86.addcarryx.u64(i8 0, i64 0, i64 0, i8* null) + ret void +} diff --git a/test/CodeGen/X86/avx512bw-intrinsics.ll b/test/CodeGen/X86/avx512bw-intrinsics.ll index 5472f057ef27..4abe3df9fc2a 100644 --- a/test/CodeGen/X86/avx512bw-intrinsics.ll +++ b/test/CodeGen/X86/avx512bw-intrinsics.ll @@ -1921,9 +1921,9 @@ define <64 x i8>@test_int_x86_avx512_mask_pbroadcast_b_gpr_512(i8 %x0, <64 x i8> ; AVX512BW-LABEL: test_int_x86_avx512_mask_pbroadcast_b_gpr_512: ; AVX512BW: ## BB#0: ; AVX512BW-NEXT: kmovq %rsi, %k1 -; AVX512BW-NEXT: vpbroadcastb %dil, %zmm0 {%k1} -; AVX512BW-NEXT: vpbroadcastb %dil, %zmm1 {%k1} {z} -; AVX512BW-NEXT: vpbroadcastb %dil, %zmm2 +; AVX512BW-NEXT: vpbroadcastb %edi, %zmm1 {%k1} {z} +; AVX512BW-NEXT: vpbroadcastb %edi, %zmm0 {%k1} +; AVX512BW-NEXT: vpbroadcastb %edi, %zmm2 ; AVX512BW-NEXT: vpaddb %zmm0, %zmm2, %zmm0 ; AVX512BW-NEXT: vpaddb %zmm0, %zmm1, %zmm0 ; AVX512BW-NEXT: retq @@ -1934,9 +1934,9 @@ define <64 x i8>@test_int_x86_avx512_mask_pbroadcast_b_gpr_512(i8 %x0, <64 x i8> ; AVX512F-32-NEXT: kmovd {{[0-9]+}}(%esp), %k0 ; AVX512F-32-NEXT: kmovd {{[0-9]+}}(%esp), %k1 ; AVX512F-32-NEXT: kunpckdq %k0, %k1, %k1 -; AVX512F-32-NEXT: vpbroadcastb %al, %zmm1 {%k1} {z} -; AVX512F-32-NEXT: vpbroadcastb %al, %zmm0 {%k1} -; AVX512F-32-NEXT: vpbroadcastb %al, %zmm2 +; AVX512F-32-NEXT: vpbroadcastb %eax, %zmm1 {%k1} {z} +; AVX512F-32-NEXT: vpbroadcastb %eax, %zmm0 {%k1} +; AVX512F-32-NEXT: vpbroadcastb %eax, %zmm2 ; AVX512F-32-NEXT: vpaddb %zmm0, %zmm2, %zmm0 ; AVX512F-32-NEXT: vpaddb %zmm0, %zmm1, %zmm0 ; AVX512F-32-NEXT: retl @@ -1954,20 +1954,20 @@ define <32 x i16>@test_int_x86_avx512_mask_pbroadcast_w_gpr_512(i16 %x0, <32 x i ; AVX512BW-LABEL: test_int_x86_avx512_mask_pbroadcast_w_gpr_512: ; AVX512BW: ## BB#0: ; AVX512BW-NEXT: kmovd %esi, %k1 -; AVX512BW-NEXT: vpbroadcastw %di, %zmm0 {%k1} -; AVX512BW-NEXT: vpbroadcastw %di, %zmm1 {%k1} {z} -; AVX512BW-NEXT: vpbroadcastw %di, %zmm2 +; AVX512BW-NEXT: vpbroadcastw %edi, %zmm1 {%k1} {z} +; AVX512BW-NEXT: vpbroadcastw %edi, %zmm0 {%k1} +; AVX512BW-NEXT: vpbroadcastw %edi, %zmm2 ; AVX512BW-NEXT: vpaddw %zmm0, %zmm2, %zmm0 ; AVX512BW-NEXT: vpaddw %zmm0, %zmm1, %zmm0 ; AVX512BW-NEXT: retq ; ; AVX512F-32-LABEL: test_int_x86_avx512_mask_pbroadcast_w_gpr_512: ; AVX512F-32: # BB#0: -; AVX512F-32-NEXT: movzwl {{[0-9]+}}(%esp), %eax ; AVX512F-32-NEXT: kmovd {{[0-9]+}}(%esp), %k1 -; AVX512F-32-NEXT: vpbroadcastw %ax, %zmm0 {%k1} -; AVX512F-32-NEXT: vpbroadcastw %ax, %zmm1 {%k1} {z} -; AVX512F-32-NEXT: vpbroadcastw %ax, %zmm2 +; AVX512F-32-NEXT: movw {{[0-9]+}}(%esp), %ax +; AVX512F-32-NEXT: vpbroadcastw %eax, %zmm1 {%k1} {z} +; AVX512F-32-NEXT: vpbroadcastw %eax, %zmm0 {%k1} +; AVX512F-32-NEXT: vpbroadcastw %eax, %zmm2 ; AVX512F-32-NEXT: vpaddw %zmm0, %zmm2, %zmm0 ; AVX512F-32-NEXT: vpaddw %zmm0, %zmm1, %zmm0 ; AVX512F-32-NEXT: retl diff --git a/test/CodeGen/X86/avx512bwvl-intrinsics.ll b/test/CodeGen/X86/avx512bwvl-intrinsics.ll index c3ba6f106e6a..9ceb3e5931a6 100644 --- a/test/CodeGen/X86/avx512bwvl-intrinsics.ll +++ b/test/CodeGen/X86/avx512bwvl-intrinsics.ll @@ -2799,9 +2799,9 @@ define <32 x i8>@test_int_x86_avx512_mask_pbroadcast_b_gpr_256(i8 %x0, <32 x i8> ; CHECK-LABEL: test_int_x86_avx512_mask_pbroadcast_b_gpr_256: ; CHECK: ## BB#0: ; CHECK-NEXT: kmovd %esi, %k1 ## encoding: [0xc5,0xfb,0x92,0xce] -; CHECK-NEXT: vpbroadcastb %dil, %ymm0 {%k1} ## encoding: [0x62,0xf2,0x7d,0x29,0x7a,0xc7] -; CHECK-NEXT: vpbroadcastb %dil, %ymm1 {%k1} {z} ## encoding: [0x62,0xf2,0x7d,0xa9,0x7a,0xcf] -; CHECK-NEXT: vpbroadcastb %dil, %ymm2 ## encoding: [0x62,0xf2,0x7d,0x28,0x7a,0xd7] +; CHECK-NEXT: vpbroadcastb %edi, %ymm1 {%k1} {z} ## encoding: [0x62,0xf2,0x7d,0xa9,0x7a,0xcf] +; CHECK-NEXT: vpbroadcastb %edi, %ymm0 {%k1} ## encoding: [0x62,0xf2,0x7d,0x29,0x7a,0xc7] +; CHECK-NEXT: vpbroadcastb %edi, %ymm2 ## encoding: [0x62,0xf2,0x7d,0x28,0x7a,0xd7] ; CHECK-NEXT: vpaddb %ymm0, %ymm2, %ymm0 ## EVEX TO VEX Compression encoding: [0xc5,0xed,0xfc,0xc0] ; CHECK-NEXT: vpaddb %ymm0, %ymm1, %ymm0 ## EVEX TO VEX Compression encoding: [0xc5,0xf5,0xfc,0xc0] ; CHECK-NEXT: retq ## encoding: [0xc3] @@ -2819,9 +2819,9 @@ define <16 x i8>@test_int_x86_avx512_mask_pbroadcast_b_gpr_128(i8 %x0, <16 x i8> ; CHECK-LABEL: test_int_x86_avx512_mask_pbroadcast_b_gpr_128: ; CHECK: ## BB#0: ; CHECK-NEXT: kmovd %esi, %k1 ## encoding: [0xc5,0xfb,0x92,0xce] -; CHECK-NEXT: vpbroadcastb %dil, %xmm1 {%k1} {z} ## encoding: [0x62,0xf2,0x7d,0x89,0x7a,0xcf] -; CHECK-NEXT: vpbroadcastb %dil, %xmm0 {%k1} ## encoding: [0x62,0xf2,0x7d,0x09,0x7a,0xc7] -; CHECK-NEXT: vpbroadcastb %dil, %xmm2 ## encoding: [0x62,0xf2,0x7d,0x08,0x7a,0xd7] +; CHECK-NEXT: vpbroadcastb %edi, %xmm1 {%k1} {z} ## encoding: [0x62,0xf2,0x7d,0x89,0x7a,0xcf] +; CHECK-NEXT: vpbroadcastb %edi, %xmm0 {%k1} ## encoding: [0x62,0xf2,0x7d,0x09,0x7a,0xc7] +; CHECK-NEXT: vpbroadcastb %edi, %xmm2 ## encoding: [0x62,0xf2,0x7d,0x08,0x7a,0xd7] ; CHECK-NEXT: vpaddb %xmm0, %xmm2, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xe9,0xfc,0xc0] ; CHECK-NEXT: vpaddb %xmm0, %xmm1, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xf1,0xfc,0xc0] ; CHECK-NEXT: retq ## encoding: [0xc3] @@ -2839,9 +2839,9 @@ define <16 x i16>@test_int_x86_avx512_mask_pbroadcast_w_gpr_256(i16 %x0, <16 x i ; CHECK-LABEL: test_int_x86_avx512_mask_pbroadcast_w_gpr_256: ; CHECK: ## BB#0: ; CHECK-NEXT: kmovd %esi, %k1 ## encoding: [0xc5,0xfb,0x92,0xce] -; CHECK-NEXT: vpbroadcastw %di, %ymm1 {%k1} {z} ## encoding: [0x62,0xf2,0x7d,0xa9,0x7b,0xcf] -; CHECK-NEXT: vpbroadcastw %di, %ymm0 {%k1} ## encoding: [0x62,0xf2,0x7d,0x29,0x7b,0xc7] -; CHECK-NEXT: vpbroadcastw %di, %ymm2 ## encoding: [0x62,0xf2,0x7d,0x28,0x7b,0xd7] +; CHECK-NEXT: vpbroadcastw %edi, %ymm1 {%k1} {z} ## encoding: [0x62,0xf2,0x7d,0xa9,0x7b,0xcf] +; CHECK-NEXT: vpbroadcastw %edi, %ymm0 {%k1} ## encoding: [0x62,0xf2,0x7d,0x29,0x7b,0xc7] +; CHECK-NEXT: vpbroadcastw %edi, %ymm2 ## encoding: [0x62,0xf2,0x7d,0x28,0x7b,0xd7] ; CHECK-NEXT: vpaddw %ymm0, %ymm2, %ymm0 ## EVEX TO VEX Compression encoding: [0xc5,0xed,0xfd,0xc0] ; CHECK-NEXT: vpaddw %ymm0, %ymm1, %ymm0 ## EVEX TO VEX Compression encoding: [0xc5,0xf5,0xfd,0xc0] ; CHECK-NEXT: retq ## encoding: [0xc3] @@ -2859,9 +2859,9 @@ define <8 x i16>@test_int_x86_avx512_mask_pbroadcast_w_gpr_128(i16 %x0, <8 x i16 ; CHECK-LABEL: test_int_x86_avx512_mask_pbroadcast_w_gpr_128: ; CHECK: ## BB#0: ; CHECK-NEXT: kmovd %esi, %k1 ## encoding: [0xc5,0xfb,0x92,0xce] -; CHECK-NEXT: vpbroadcastw %di, %xmm1 {%k1} {z} ## encoding: [0x62,0xf2,0x7d,0x89,0x7b,0xcf] -; CHECK-NEXT: vpbroadcastw %di, %xmm0 {%k1} ## encoding: [0x62,0xf2,0x7d,0x09,0x7b,0xc7] -; CHECK-NEXT: vpbroadcastw %di, %xmm2 ## encoding: [0x62,0xf2,0x7d,0x08,0x7b,0xd7] +; CHECK-NEXT: vpbroadcastw %edi, %xmm1 {%k1} {z} ## encoding: [0x62,0xf2,0x7d,0x89,0x7b,0xcf] +; CHECK-NEXT: vpbroadcastw %edi, %xmm0 {%k1} ## encoding: [0x62,0xf2,0x7d,0x09,0x7b,0xc7] +; CHECK-NEXT: vpbroadcastw %edi, %xmm2 ## encoding: [0x62,0xf2,0x7d,0x08,0x7b,0xd7] ; CHECK-NEXT: vpaddw %xmm0, %xmm2, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xe9,0xfd,0xc0] ; CHECK-NEXT: vpaddw %xmm0, %xmm1, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xf1,0xfd,0xc0] ; CHECK-NEXT: retq ## encoding: [0xc3] diff --git a/test/CodeGen/X86/pr33349.ll b/test/CodeGen/X86/pr33349.ll new file mode 100644 index 000000000000..db866db22481 --- /dev/null +++ b/test/CodeGen/X86/pr33349.ll @@ -0,0 +1,92 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc < %s -mattr=+avx512f | FileCheck %s --check-prefix=KNL +; RUN: llc < %s -mattr=+avx512f,+avx512vl,+avx512bw,+avx512dq | FileCheck %s --check-prefix=SKX + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + + define void @test(<4 x i1> %m, <4 x x86_fp80> %v, <4 x x86_fp80>*%p) local_unnamed_addr { +; KNL-LABEL: test: +; KNL: # BB#0: # %bb +; KNL-NEXT: vpextrb $0, %xmm0, %eax +; KNL-NEXT: testb $1, %al +; KNL-NEXT: fld1 +; KNL-NEXT: fldz +; KNL-NEXT: fld %st(0) +; KNL-NEXT: fcmovne %st(2), %st(0) +; KNL-NEXT: vpextrb $4, %xmm0, %eax +; KNL-NEXT: testb $1, %al +; KNL-NEXT: fld %st(1) +; KNL-NEXT: fcmovne %st(3), %st(0) +; KNL-NEXT: vpextrb $8, %xmm0, %eax +; KNL-NEXT: testb $1, %al +; KNL-NEXT: fld %st(2) +; KNL-NEXT: fcmovne %st(4), %st(0) +; KNL-NEXT: vpextrb $12, %xmm0, %eax +; KNL-NEXT: testb $1, %al +; KNL-NEXT: fxch %st(3) +; KNL-NEXT: fcmovne %st(4), %st(0) +; KNL-NEXT: fstp %st(4) +; KNL-NEXT: fxch %st(3) +; KNL-NEXT: fstpt 30(%rdi) +; KNL-NEXT: fxch %st(1) +; KNL-NEXT: fstpt 20(%rdi) +; KNL-NEXT: fxch %st(1) +; KNL-NEXT: fstpt 10(%rdi) +; KNL-NEXT: fstpt (%rdi) +; KNL-NEXT: retq +; +; SKX-LABEL: test: +; SKX: # BB#0: # %bb +; SKX-NEXT: vpslld $31, %xmm0, %xmm0 +; SKX-NEXT: vptestmd %xmm0, %xmm0, %k0 +; SKX-NEXT: kshiftrw $2, %k0, %k1 +; SKX-NEXT: kshiftlw $15, %k1, %k2 +; SKX-NEXT: kshiftrw $15, %k2, %k2 +; SKX-NEXT: kshiftlw $15, %k2, %k2 +; SKX-NEXT: kshiftrw $15, %k2, %k2 +; SKX-NEXT: kmovd %k2, %eax +; SKX-NEXT: testb $1, %al +; SKX-NEXT: fld1 +; SKX-NEXT: fldz +; SKX-NEXT: fld %st(0) +; SKX-NEXT: fcmovne %st(2), %st(0) +; SKX-NEXT: kshiftlw $14, %k1, %k1 +; SKX-NEXT: kshiftrw $15, %k1, %k1 +; SKX-NEXT: kshiftlw $15, %k1, %k1 +; SKX-NEXT: kshiftrw $15, %k1, %k1 +; SKX-NEXT: kmovd %k1, %eax +; SKX-NEXT: testb $1, %al +; SKX-NEXT: fld %st(1) +; SKX-NEXT: fcmovne %st(3), %st(0) +; SKX-NEXT: kshiftlw $15, %k0, %k1 +; SKX-NEXT: kshiftrw $15, %k1, %k1 +; SKX-NEXT: kshiftlw $15, %k1, %k1 +; SKX-NEXT: kshiftrw $15, %k1, %k1 +; SKX-NEXT: kmovd %k1, %eax +; SKX-NEXT: testb $1, %al +; SKX-NEXT: fld %st(2) +; SKX-NEXT: fcmovne %st(4), %st(0) +; SKX-NEXT: kshiftlw $14, %k0, %k0 +; SKX-NEXT: kshiftrw $15, %k0, %k0 +; SKX-NEXT: kshiftlw $15, %k0, %k0 +; SKX-NEXT: kshiftrw $15, %k0, %k0 +; SKX-NEXT: kmovd %k0, %eax +; SKX-NEXT: testb $1, %al +; SKX-NEXT: fxch %st(3) +; SKX-NEXT: fcmovne %st(4), %st(0) +; SKX-NEXT: fstp %st(4) +; SKX-NEXT: fxch %st(3) +; SKX-NEXT: fstpt 10(%rdi) +; SKX-NEXT: fxch %st(1) +; SKX-NEXT: fstpt (%rdi) +; SKX-NEXT: fxch %st(1) +; SKX-NEXT: fstpt 30(%rdi) +; SKX-NEXT: fstpt 20(%rdi) +; SKX-NEXT: retq + bb: + %tmp = select <4 x i1> %m, <4 x x86_fp80> , <4 x x86_fp80> zeroinitializer + store <4 x x86_fp80> %tmp, <4 x x86_fp80>* %p, align 16 + ret void + } + diff --git a/test/CodeGen/X86/pr34088.ll b/test/CodeGen/X86/pr34088.ll new file mode 100644 index 000000000000..d3667e3884d4 --- /dev/null +++ b/test/CodeGen/X86/pr34088.ll @@ -0,0 +1,46 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc < %s -mtriple=i686-unknown -mcpu=pentium4 | FileCheck %s + +%struct.Foo = type { i32, %struct.Bar } +%struct.Bar = type { i32, %struct.Buffer, i32 } +%struct.Buffer = type { i8*, i32 } + +; This test checks that the load of store %2 is not dropped. +; +define i32 @pr34088() local_unnamed_addr { +; CHECK-LABEL: pr34088: +; CHECK: # BB#0: # %entry +; CHECK-NEXT: pushl %ebp +; CHECK-NEXT: .Lcfi0: +; CHECK-NEXT: .cfi_def_cfa_offset 8 +; CHECK-NEXT: .Lcfi1: +; CHECK-NEXT: .cfi_offset %ebp, -8 +; CHECK-NEXT: movl %esp, %ebp +; CHECK-NEXT: .Lcfi2: +; CHECK-NEXT: .cfi_def_cfa_register %ebp +; CHECK-NEXT: andl $-16, %esp +; CHECK-NEXT: subl $32, %esp +; CHECK-NEXT: xorps %xmm0, %xmm0 +; CHECK-NEXT: movaps {{.*#+}} xmm1 = [205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205] +; CHECK-NEXT: xorl %eax, %eax +; CHECK-NEXT: movaps %xmm0, (%esp) +; CHECK-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero +; CHECK-NEXT: movaps %xmm1, (%esp) +; CHECK-NEXT: movl $-842150451, {{[0-9]+}}(%esp) # imm = 0xCDCDCDCD +; CHECK-NEXT: movsd %xmm0, {{[0-9]+}}(%esp) +; CHECK-NEXT: movl %ebp, %esp +; CHECK-NEXT: popl %ebp +; CHECK-NEXT: retl +entry: + %foo = alloca %struct.Foo, align 4 + %0 = bitcast %struct.Foo* %foo to i8* + call void @llvm.memset.p0i8.i32(i8* nonnull %0, i8 0, i32 20, i32 4, i1 false) + %buffer1 = getelementptr inbounds %struct.Foo, %struct.Foo* %foo, i32 0, i32 1, i32 1 + %1 = bitcast %struct.Buffer* %buffer1 to i64* + %2 = load i64, i64* %1, align 4 + call void @llvm.memset.p0i8.i32(i8* nonnull %0, i8 -51, i32 20, i32 4, i1 false) + store i64 %2, i64* %1, align 4 + ret i32 0 +} + +declare void @llvm.memset.p0i8.i32(i8* nocapture writeonly, i8, i32, i32, i1) diff --git a/test/CodeGen/X86/select-mmx.ll b/test/CodeGen/X86/select-mmx.ll new file mode 100644 index 000000000000..9e6382faaa59 --- /dev/null +++ b/test/CodeGen/X86/select-mmx.ll @@ -0,0 +1,120 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc -mtriple=x86_64-unknown-unknown -mattr=+mmx < %s | FileCheck %s --check-prefix=X64 +; RUN: llc -mtriple=i686-unknown-unknown -mattr=+mmx < %s | FileCheck %s --check-prefix=I32 + + +; From source: clang -02 +;__m64 test47(int a) +;{ +; __m64 x = (a)? (__m64)(7): (__m64)(0); +; return __builtin_ia32_psllw(x, x); +;} + +define i64 @test47(i64 %arg) { +; +; X64-LABEL: test47: +; X64: # BB#0: +; X64-NEXT: xorl %eax, %eax +; X64-NEXT: testq %rdi, %rdi +; X64-NEXT: movl $7, %ecx +; X64-NEXT: cmoveq %rcx, %rax +; X64-NEXT: movd %rax, %mm0 +; X64-NEXT: psllw %mm0, %mm0 +; X64-NEXT: movd %mm0, %rax +; X64-NEXT: retq +; +; I32-LABEL: test47: +; I32: # BB#0: +; I32-NEXT: pushl %ebp +; I32-NEXT: .Lcfi0: +; I32-NEXT: .cfi_def_cfa_offset 8 +; I32-NEXT: .Lcfi1: +; I32-NEXT: .cfi_offset %ebp, -8 +; I32-NEXT: movl %esp, %ebp +; I32-NEXT: .Lcfi2: +; I32-NEXT: .cfi_def_cfa_register %ebp +; I32-NEXT: andl $-8, %esp +; I32-NEXT: subl $16, %esp +; I32-NEXT: movl 8(%ebp), %eax +; I32-NEXT: orl 12(%ebp), %eax +; I32-NEXT: movl $7, %eax +; I32-NEXT: je .LBB0_2 +; I32-NEXT: # BB#1: +; I32-NEXT: xorl %eax, %eax +; I32-NEXT: .LBB0_2: +; I32-NEXT: movl %eax, {{[0-9]+}}(%esp) +; I32-NEXT: movl $0, {{[0-9]+}}(%esp) +; I32-NEXT: movq {{[0-9]+}}(%esp), %mm0 +; I32-NEXT: psllw %mm0, %mm0 +; I32-NEXT: movq %mm0, (%esp) +; I32-NEXT: movl (%esp), %eax +; I32-NEXT: movl {{[0-9]+}}(%esp), %edx +; I32-NEXT: movl %ebp, %esp +; I32-NEXT: popl %ebp +; I32-NEXT: retl + %cond = icmp eq i64 %arg, 0 + %slct = select i1 %cond, x86_mmx bitcast (i64 7 to x86_mmx), x86_mmx bitcast (i64 0 to x86_mmx) + %psll = tail call x86_mmx @llvm.x86.mmx.psll.w(x86_mmx %slct, x86_mmx %slct) + %retc = bitcast x86_mmx %psll to i64 + ret i64 %retc +} + + +; From source: clang -O2 +;__m64 test49(int a, long long n, long long m) +;{ +; __m64 x = (a)? (__m64)(n): (__m64)(m); +; return __builtin_ia32_psllw(x, x); +;} + +define i64 @test49(i64 %arg, i64 %x, i64 %y) { +; +; X64-LABEL: test49: +; X64: # BB#0: +; X64-NEXT: testq %rdi, %rdi +; X64-NEXT: cmovneq %rdx, %rsi +; X64-NEXT: movd %rsi, %mm0 +; X64-NEXT: psllw %mm0, %mm0 +; X64-NEXT: movd %mm0, %rax +; X64-NEXT: retq +; +; I32-LABEL: test49: +; I32: # BB#0: +; I32-NEXT: pushl %ebp +; I32-NEXT: .Lcfi3: +; I32-NEXT: .cfi_def_cfa_offset 8 +; I32-NEXT: .Lcfi4: +; I32-NEXT: .cfi_offset %ebp, -8 +; I32-NEXT: movl %esp, %ebp +; I32-NEXT: .Lcfi5: +; I32-NEXT: .cfi_def_cfa_register %ebp +; I32-NEXT: andl $-8, %esp +; I32-NEXT: subl $8, %esp +; I32-NEXT: movl 8(%ebp), %eax +; I32-NEXT: orl 12(%ebp), %eax +; I32-NEXT: je .LBB1_1 +; I32-NEXT: # BB#2: +; I32-NEXT: leal 24(%ebp), %eax +; I32-NEXT: jmp .LBB1_3 +; I32-NEXT: .LBB1_1: +; I32-NEXT: leal 16(%ebp), %eax +; I32-NEXT: .LBB1_3: +; I32-NEXT: movq (%eax), %mm0 +; I32-NEXT: psllw %mm0, %mm0 +; I32-NEXT: movq %mm0, (%esp) +; I32-NEXT: movl (%esp), %eax +; I32-NEXT: movl {{[0-9]+}}(%esp), %edx +; I32-NEXT: movl %ebp, %esp +; I32-NEXT: popl %ebp +; I32-NEXT: retl + %cond = icmp eq i64 %arg, 0 + %xmmx = bitcast i64 %x to x86_mmx + %ymmx = bitcast i64 %y to x86_mmx + %slct = select i1 %cond, x86_mmx %xmmx, x86_mmx %ymmx + %psll = tail call x86_mmx @llvm.x86.mmx.psll.w(x86_mmx %slct, x86_mmx %slct) + %retc = bitcast x86_mmx %psll to i64 + ret i64 %retc +} + +declare x86_mmx @llvm.x86.mmx.psll.w(x86_mmx, x86_mmx) + diff --git a/test/CodeGen/X86/vector-shuffle-128-v16.ll b/test/CodeGen/X86/vector-shuffle-128-v16.ll index abba0ff87ace..9f1ed021992d 100644 --- a/test/CodeGen/X86/vector-shuffle-128-v16.ll +++ b/test/CodeGen/X86/vector-shuffle-128-v16.ll @@ -1643,7 +1643,7 @@ define <16 x i8> @insert_dup_elt1_mem_v16i8_sext_i8(i8* %ptr) { ; AVX512VL: # BB#0: ; AVX512VL-NEXT: movsbl (%rdi), %eax ; AVX512VL-NEXT: shrl $8, %eax -; AVX512VL-NEXT: vpbroadcastb %al, %xmm0 +; AVX512VL-NEXT: vpbroadcastb %eax, %xmm0 ; AVX512VL-NEXT: retq %tmp = load i8, i8* %ptr, align 1 %tmp1 = sext i8 %tmp to i32 @@ -1696,7 +1696,7 @@ define <16 x i8> @insert_dup_elt2_mem_v16i8_sext_i8(i8* %ptr) { ; AVX512VL: # BB#0: ; AVX512VL-NEXT: movsbl (%rdi), %eax ; AVX512VL-NEXT: shrl $16, %eax -; AVX512VL-NEXT: vpbroadcastb %al, %xmm0 +; AVX512VL-NEXT: vpbroadcastb %eax, %xmm0 ; AVX512VL-NEXT: retq %tmp = load i8, i8* %ptr, align 1 %tmp1 = sext i8 %tmp to i32 diff --git a/test/CodeGen/X86/vector-shuffle-128-v8.ll b/test/CodeGen/X86/vector-shuffle-128-v8.ll index c03b9d1472c1..1cf8453fc6ad 100644 --- a/test/CodeGen/X86/vector-shuffle-128-v8.ll +++ b/test/CodeGen/X86/vector-shuffle-128-v8.ll @@ -2274,7 +2274,7 @@ define <8 x i16> @insert_dup_mem_v8i16_sext_i16(i16* %ptr) { ; AVX512VL-LABEL: insert_dup_mem_v8i16_sext_i16: ; AVX512VL: # BB#0: ; AVX512VL-NEXT: movswl (%rdi), %eax -; AVX512VL-NEXT: vpbroadcastw %ax, %xmm0 +; AVX512VL-NEXT: vpbroadcastw %eax, %xmm0 ; AVX512VL-NEXT: retq %tmp = load i16, i16* %ptr, align 2 %tmp1 = sext i16 %tmp to i32 @@ -2390,7 +2390,7 @@ define <8 x i16> @insert_dup_elt1_mem_v8i16_sext_i16(i16* %ptr) { ; AVX512VL: # BB#0: ; AVX512VL-NEXT: movswl (%rdi), %eax ; AVX512VL-NEXT: shrl $16, %eax -; AVX512VL-NEXT: vpbroadcastw %ax, %xmm0 +; AVX512VL-NEXT: vpbroadcastw %eax, %xmm0 ; AVX512VL-NEXT: retq %tmp = load i16, i16* %ptr, align 2 %tmp1 = sext i16 %tmp to i32 @@ -2443,7 +2443,7 @@ define <8 x i16> @insert_dup_elt3_mem_v8i16_sext_i16(i16* %ptr) { ; AVX512VL: # BB#0: ; AVX512VL-NEXT: movswl (%rdi), %eax ; AVX512VL-NEXT: shrl $16, %eax -; AVX512VL-NEXT: vpbroadcastw %ax, %xmm0 +; AVX512VL-NEXT: vpbroadcastw %eax, %xmm0 ; AVX512VL-NEXT: retq %tmp = load i16, i16* %ptr, align 2 %tmp1 = sext i16 %tmp to i32 diff --git a/test/CodeGen/X86/vector-shuffle-256-v16.ll b/test/CodeGen/X86/vector-shuffle-256-v16.ll index 6f5d916f2294..ba7c0894b932 100644 --- a/test/CodeGen/X86/vector-shuffle-256-v16.ll +++ b/test/CodeGen/X86/vector-shuffle-256-v16.ll @@ -4069,7 +4069,7 @@ define <16 x i16> @insert_dup_mem_v16i16_sext_i16(i16* %ptr) { ; AVX512VL-LABEL: insert_dup_mem_v16i16_sext_i16: ; AVX512VL: # BB#0: ; AVX512VL-NEXT: movswl (%rdi), %eax -; AVX512VL-NEXT: vpbroadcastw %ax, %ymm0 +; AVX512VL-NEXT: vpbroadcastw %eax, %ymm0 ; AVX512VL-NEXT: retq %tmp = load i16, i16* %ptr, align 2 %tmp1 = sext i16 %tmp to i32 diff --git a/test/CodeGen/X86/vector-shuffle-256-v32.ll b/test/CodeGen/X86/vector-shuffle-256-v32.ll index 05a797cb6f8e..d51b69415b93 100644 --- a/test/CodeGen/X86/vector-shuffle-256-v32.ll +++ b/test/CodeGen/X86/vector-shuffle-256-v32.ll @@ -2431,7 +2431,7 @@ define <32 x i8> @insert_dup_elt1_mem_v32i8_sext_i8(i8* %ptr) { ; AVX512VL: # BB#0: ; AVX512VL-NEXT: movsbl (%rdi), %eax ; AVX512VL-NEXT: shrl $8, %eax -; AVX512VL-NEXT: vpbroadcastb %al, %ymm0 +; AVX512VL-NEXT: vpbroadcastb %eax, %ymm0 ; AVX512VL-NEXT: retq %tmp = load i8, i8* %ptr, align 1 %tmp1 = sext i8 %tmp to i32 diff --git a/test/CodeGen/X86/vector-shuffle-512-v32.ll b/test/CodeGen/X86/vector-shuffle-512-v32.ll index 7a5c992bb829..b8fc27ba5515 100644 --- a/test/CodeGen/X86/vector-shuffle-512-v32.ll +++ b/test/CodeGen/X86/vector-shuffle-512-v32.ll @@ -228,7 +228,7 @@ define <32 x i16> @insert_dup_mem_v32i16_i32(i32* %ptr) { ; SKX-LABEL: insert_dup_mem_v32i16_i32: ; SKX: ## BB#0: ; SKX-NEXT: movl (%rdi), %eax -; SKX-NEXT: vpbroadcastw %ax, %zmm0 +; SKX-NEXT: vpbroadcastw %eax, %zmm0 ; SKX-NEXT: retq %tmp = load i32, i32* %ptr, align 4 %tmp1 = insertelement <4 x i32> zeroinitializer, i32 %tmp, i32 0 @@ -249,7 +249,7 @@ define <32 x i16> @insert_dup_mem_v32i16_sext_i16(i16* %ptr) { ; SKX-LABEL: insert_dup_mem_v32i16_sext_i16: ; SKX: ## BB#0: ; SKX-NEXT: movswl (%rdi), %eax -; SKX-NEXT: vpbroadcastw %ax, %zmm0 +; SKX-NEXT: vpbroadcastw %eax, %zmm0 ; SKX-NEXT: retq %tmp = load i16, i16* %ptr, align 2 %tmp1 = sext i16 %tmp to i32 @@ -269,7 +269,7 @@ define <32 x i16> @insert_dup_elt1_mem_v32i16_i32(i32* %ptr) #0 { ; SKX-LABEL: insert_dup_elt1_mem_v32i16_i32: ; SKX: ## BB#0: ; SKX-NEXT: movzwl 2(%rdi), %eax -; SKX-NEXT: vpbroadcastw %ax, %zmm0 +; SKX-NEXT: vpbroadcastw %eax, %zmm0 ; SKX-NEXT: retq %tmp = load i32, i32* %ptr, align 4 %tmp1 = insertelement <4 x i32> zeroinitializer, i32 %tmp, i32 0 @@ -288,7 +288,7 @@ define <32 x i16> @insert_dup_elt3_mem_v32i16_i32(i32* %ptr) #0 { ; SKX-LABEL: insert_dup_elt3_mem_v32i16_i32: ; SKX: ## BB#0: ; SKX-NEXT: movzwl 2(%rdi), %eax -; SKX-NEXT: vpbroadcastw %ax, %zmm0 +; SKX-NEXT: vpbroadcastw %eax, %zmm0 ; SKX-NEXT: retq %tmp = load i32, i32* %ptr, align 4 %tmp1 = insertelement <4 x i32> zeroinitializer, i32 %tmp, i32 1 diff --git a/test/CodeGen/X86/vector-shuffle-512-v64.ll b/test/CodeGen/X86/vector-shuffle-512-v64.ll index f4650ec741a7..9dca3191e06b 100644 --- a/test/CodeGen/X86/vector-shuffle-512-v64.ll +++ b/test/CodeGen/X86/vector-shuffle-512-v64.ll @@ -332,7 +332,7 @@ define <64 x i8> @insert_dup_elt1_mem_v64i8_sext_i8(i8* %ptr) { ; AVX512BW: # BB#0: ; AVX512BW-NEXT: movsbl (%rdi), %eax ; AVX512BW-NEXT: shrl $8, %eax -; AVX512BW-NEXT: vpbroadcastb %al, %zmm0 +; AVX512BW-NEXT: vpbroadcastb %eax, %zmm0 ; AVX512BW-NEXT: retq ; ; AVX512DQ-LABEL: insert_dup_elt1_mem_v64i8_sext_i8: @@ -348,7 +348,7 @@ define <64 x i8> @insert_dup_elt1_mem_v64i8_sext_i8(i8* %ptr) { ; AVX512VBMI: # BB#0: ; AVX512VBMI-NEXT: movsbl (%rdi), %eax ; AVX512VBMI-NEXT: shrl $8, %eax -; AVX512VBMI-NEXT: vpbroadcastb %al, %zmm0 +; AVX512VBMI-NEXT: vpbroadcastb %eax, %zmm0 ; AVX512VBMI-NEXT: retq %tmp = load i8, i8* %ptr, align 1 %tmp1 = sext i8 %tmp to i32 diff --git a/test/Instrumentation/DataFlowSanitizer/Inputs/shadow-args-abilist.txt b/test/Instrumentation/DataFlowSanitizer/Inputs/shadow-args-abilist.txt new file mode 100644 index 000000000000..723cbc9086da --- /dev/null +++ b/test/Instrumentation/DataFlowSanitizer/Inputs/shadow-args-abilist.txt @@ -0,0 +1,8 @@ +fun:dfsan_get_label=uninstrumented +fun:dfsan_get_label=custom + +fun:k2=uninstrumented +fun:k2=custom + +fun:k4=uninstrumented +fun:k4=custom diff --git a/test/Instrumentation/DataFlowSanitizer/abilist.ll b/test/Instrumentation/DataFlowSanitizer/abilist.ll index 8b30875a03fa..e33237ffe19d 100644 --- a/test/Instrumentation/DataFlowSanitizer/abilist.ll +++ b/test/Instrumentation/DataFlowSanitizer/abilist.ll @@ -47,13 +47,13 @@ define void @f(i32 %x) { ; CHECK: %[[LABELVA1:.*]] = alloca [2 x i16] ; CHECK: %[[LABELRETURN:.*]] = alloca i16 - ; CHECK: call void @__dfsw_custom1(i32 1, i32 2, i16 0, i16 0) + ; CHECK: call void @__dfsw_custom1(i32 1, i32 2, i16 zeroext 0, i16 zeroext 0) call void @custom1(i32 1, i32 2) - ; CHECK: call i32 @__dfsw_custom2(i32 1, i32 2, i16 0, i16 0, i16* %[[LABELRETURN]]) + ; CHECK: call i32 @__dfsw_custom2(i32 1, i32 2, i16 zeroext 0, i16 zeroext 0, i16* %[[LABELRETURN]]) call i32 @custom2(i32 1, i32 2) - ; CHECK: call void @__dfsw_customcb({{.*}} @"dfst0$customcb", i8* bitcast ({{.*}} @"dfs$cb" to i8*), i16 0) + ; CHECK: call void @__dfsw_customcb({{.*}} @"dfst0$customcb", i8* bitcast ({{.*}} @"dfs$cb" to i8*), i16 zeroext 0) call void @customcb(i32 (i32)* @cb) ; CHECK: %[[LABELVA1_0:.*]] = getelementptr inbounds [2 x i16], [2 x i16]* %[[LABELVA1]], i32 0, i32 0 @@ -61,12 +61,12 @@ define void @f(i32 %x) { ; CHECK: %[[LABELVA1_1:.*]] = getelementptr inbounds [2 x i16], [2 x i16]* %[[LABELVA1]], i32 0, i32 1 ; CHECK: store i16 %{{.*}}, i16* %[[LABELVA1_1]] ; CHECK: %[[LABELVA1_0A:.*]] = getelementptr inbounds [2 x i16], [2 x i16]* %[[LABELVA1]], i32 0, i32 0 - ; CHECK: call void (i32, i16, i16*, ...) @__dfsw_custom3(i32 1, i16 0, i16* %[[LABELVA1_0A]], i32 2, i32 %{{.*}}) + ; CHECK: call void (i32, i16, i16*, ...) @__dfsw_custom3(i32 1, i16 zeroext 0, i16* %[[LABELVA1_0A]], i32 2, i32 %{{.*}}) call void (i32, ...) @custom3(i32 1, i32 2, i32 %x) ; CHECK: %[[LABELVA2_0:.*]] = getelementptr inbounds [2 x i16], [2 x i16]* %[[LABELVA2]], i32 0, i32 0 ; CHECK: %[[LABELVA2_0A:.*]] = getelementptr inbounds [2 x i16], [2 x i16]* %[[LABELVA2]], i32 0, i32 0 - ; CHECK: call i32 (i32, i16, i16*, i16*, ...) @__dfsw_custom4(i32 1, i16 0, i16* %[[LABELVA2_0A]], i16* %[[LABELRETURN]], i32 2, i32 3) + ; CHECK: call i32 (i32, i16, i16*, i16*, ...) @__dfsw_custom4(i32 1, i16 zeroext 0, i16* %[[LABELVA2_0A]], i16* %[[LABELRETURN]], i32 2, i32 3) call i32 (i32, ...) @custom4(i32 1, i32 2, i32 3) ret void diff --git a/test/Instrumentation/DataFlowSanitizer/shadow-args-zext.ll b/test/Instrumentation/DataFlowSanitizer/shadow-args-zext.ll new file mode 100644 index 000000000000..0ffbf1970e7f --- /dev/null +++ b/test/Instrumentation/DataFlowSanitizer/shadow-args-zext.ll @@ -0,0 +1,54 @@ +; RUN: opt -mtriple=x86_64-unknown-linux-gnu < %s -dfsan -S --dfsan-abilist=%S/Inputs/shadow-args-abilist.txt | FileCheck %s + +; REQUIRES: x86-registered-target + +; Test that the custom abi marks shadow parameters as zero extended. + +define i32 @m() { +entry: + %call = call zeroext i16 @dfsan_get_label(i64 signext 56) + %conv = zext i16 %call to i32 + ret i32 %conv +} + +; CHECK-LABEL: @"dfs$m" +; CHECK: %{{.*}} = call zeroext i16 @__dfsw_dfsan_get_label(i64 signext 56, i16 zeroext 0, i16* %{{.*}}) + +define i32 @k() { +entry: + %call = call zeroext i16 @k2(i64 signext 56, i64 signext 67) + %conv = zext i16 %call to i32 + ret i32 %conv +} + +; CHECK-LABEL: @"dfs$k" +; CHECK: %{{.*}} = call zeroext i16 @__dfsw_k2(i64 signext 56, i64 signext 67, i16 zeroext {{.*}}, i16 zeroext {{.*}}, i16* %{{.*}}) + +define i32 @k3() { +entry: + %call = call zeroext i16 @k4(i64 signext 56, i64 signext 67, i64 signext 78, i64 signext 89) + %conv = zext i16 %call to i32 + ret i32 %conv +} + +; CHECK-LABEL: @"dfs$k3" +; CHECK: %{{.*}} = call zeroext i16 @__dfsw_k4(i64 signext 56, i64 signext 67, i64 signext 78, i64 signext 89, i16 zeroext {{.*}}, i16 zeroext {{.*}}, i16 zeroext {{.*}}, i16 zeroext {{.*}}, i16* %{{.*}}) + +declare zeroext i16 @dfsan_get_label(i64 signext) + +; CHECK-LABEL: @"dfsw$dfsan_get_label" +; CHECK: %{{.*}} = call i16 @__dfsw_dfsan_get_label(i64 %0, i16 zeroext %1, i16* %{{.*}}) + +declare zeroext i16 @k2(i64 signext, i64 signext) +; CHECK-LABEL: @"dfsw$k2" +; CHECK: %{{.*}} = call i16 @__dfsw_k2(i64 %{{.*}}, i64 %{{.*}}, i16 zeroext %{{.*}}, i16 zeroext %{{.*}}, i16* %{{.*}}) + +declare zeroext i16 @k4(i64 signext, i64 signext, i64 signext, i64 signext) + +; CHECK-LABEL: @"dfsw$k4" +; CHECK: %{{.*}} = call i16 @__dfsw_k4(i64 %{{.*}}, i64 %{{.*}}, i64 %{{.*}}, i64 %{{.*}}, i16 zeroext %{{.*}}, i16 zeroext %{{.*}}, i16 zeroext %{{.*}}, i16 zeroext %{{.*}}, i16* %{{.*}}) + + +; CHECK: declare zeroext i16 @__dfsw_dfsan_get_label(i64 signext, i16, i16*) +; CHECK: declare zeroext i16 @__dfsw_k2(i64 signext, i64 signext, i16, i16, i16*) +; CHECK: declare zeroext i16 @__dfsw_k4(i64 signext, i64 signext, i64 signext, i64 signext, i16, i16, i16, i16, i16*) diff --git a/test/Transforms/BDCE/invalidate-assumptions.ll b/test/Transforms/BDCE/invalidate-assumptions.ll new file mode 100644 index 000000000000..d165d74be86d --- /dev/null +++ b/test/Transforms/BDCE/invalidate-assumptions.ll @@ -0,0 +1,100 @@ +; RUN: opt -bdce %s -S | FileCheck %s + +; The 'nuw' on the subtract allows us to deduce that %setbit is not demanded. +; But if we change that value to '0', then the 'nuw' is no longer valid. If we don't +; remove the 'nuw', another pass (-instcombine) may make a transform based on an +; that incorrect assumption and we can miscompile: +; https://bugs.llvm.org/show_bug.cgi?id=33695 + +define i1 @PR33695(i1 %b, i8 %x) { +; CHECK-LABEL: @PR33695( +; CHECK-NEXT: [[SETBIT:%.*]] = or i8 %x, 64 +; CHECK-NEXT: [[LITTLE_NUMBER:%.*]] = zext i1 %b to i8 +; CHECK-NEXT: [[BIG_NUMBER:%.*]] = shl i8 0, 1 +; CHECK-NEXT: [[SUB:%.*]] = sub i8 [[BIG_NUMBER]], [[LITTLE_NUMBER]] +; CHECK-NEXT: [[TRUNC:%.*]] = trunc i8 [[SUB]] to i1 +; CHECK-NEXT: ret i1 [[TRUNC]] +; + %setbit = or i8 %x, 64 + %little_number = zext i1 %b to i8 + %big_number = shl i8 %setbit, 1 + %sub = sub nuw i8 %big_number, %little_number + %trunc = trunc i8 %sub to i1 + ret i1 %trunc +} + +; Similar to above, but now with more no-wrap. +; https://bugs.llvm.org/show_bug.cgi?id=34037 + +define i64 @PR34037(i64 %m, i32 %r, i64 %j, i1 %b, i32 %k, i64 %p) { +; CHECK-LABEL: @PR34037( +; CHECK-NEXT: [[CONV:%.*]] = zext i32 %r to i64 +; CHECK-NEXT: [[AND:%.*]] = and i64 %m, 0 +; CHECK-NEXT: [[NEG:%.*]] = xor i64 0, 34359738367 +; CHECK-NEXT: [[OR:%.*]] = or i64 %j, 0 +; CHECK-NEXT: [[SHL:%.*]] = shl i64 0, 29 +; CHECK-NEXT: [[CONV1:%.*]] = select i1 %b, i64 7, i64 0 +; CHECK-NEXT: [[SUB:%.*]] = sub i64 [[SHL]], [[CONV1]] +; CHECK-NEXT: [[CONV2:%.*]] = zext i32 %k to i64 +; CHECK-NEXT: [[MUL:%.*]] = mul i64 [[SUB]], [[CONV2]] +; CHECK-NEXT: [[CONV4:%.*]] = and i64 %p, 65535 +; CHECK-NEXT: [[AND5:%.*]] = and i64 [[MUL]], [[CONV4]] +; CHECK-NEXT: ret i64 [[AND5]] +; + %conv = zext i32 %r to i64 + %and = and i64 %m, %conv + %neg = xor i64 %and, 34359738367 + %or = or i64 %j, %neg + %shl = shl i64 %or, 29 + %conv1 = select i1 %b, i64 7, i64 0 + %sub = sub nuw nsw i64 %shl, %conv1 + %conv2 = zext i32 %k to i64 + %mul = mul nsw i64 %sub, %conv2 + %conv4 = and i64 %p, 65535 + %and5 = and i64 %mul, %conv4 + ret i64 %and5 +} + +; This is a manufactured example based on the 1st test to prove that the +; assumption-killing algorithm stops at the call. Ie, it does not remove +; nsw/nuw from the 'add' because a call demands all bits of its argument. + +declare i1 @foo(i1) + +define i1 @poison_on_call_user_is_ok(i1 %b, i8 %x) { +; CHECK-LABEL: @poison_on_call_user_is_ok( +; CHECK-NEXT: [[SETBIT:%.*]] = or i8 %x, 64 +; CHECK-NEXT: [[LITTLE_NUMBER:%.*]] = zext i1 %b to i8 +; CHECK-NEXT: [[BIG_NUMBER:%.*]] = shl i8 0, 1 +; CHECK-NEXT: [[SUB:%.*]] = sub i8 [[BIG_NUMBER]], [[LITTLE_NUMBER]] +; CHECK-NEXT: [[TRUNC:%.*]] = trunc i8 [[SUB]] to i1 +; CHECK-NEXT: [[CALL_RESULT:%.*]] = call i1 @foo(i1 [[TRUNC]]) +; CHECK-NEXT: [[ADD:%.*]] = add nuw nsw i1 [[CALL_RESULT]], true +; CHECK-NEXT: [[MUL:%.*]] = mul i1 [[TRUNC]], [[ADD]] +; CHECK-NEXT: ret i1 [[MUL]] +; + %setbit = or i8 %x, 64 + %little_number = zext i1 %b to i8 + %big_number = shl i8 %setbit, 1 + %sub = sub nuw i8 %big_number, %little_number + %trunc = trunc i8 %sub to i1 + %call_result = call i1 @foo(i1 %trunc) + %add = add nsw nuw i1 %call_result, 1 + %mul = mul i1 %trunc, %add + ret i1 %mul +} + + +; We were asserting that all users of a trivialized integer-type instruction were +; also integer-typed, but that's too strong. The alloca has a pointer-type result. + +define void @PR34179(i32* %a) { +; CHECK-LABEL: @PR34179( +; CHECK-NEXT: [[T0:%.*]] = load volatile i32, i32* %a +; CHECK-NEXT: ret void +; + %t0 = load volatile i32, i32* %a + %vla = alloca i32, i32 %t0 + ret void +} + diff --git a/test/Transforms/IndVarSimplify/exit_value_test2.ll b/test/Transforms/IndVarSimplify/exit_value_test2.ll index ee641667506c..7b6e91a742b2 100644 --- a/test/Transforms/IndVarSimplify/exit_value_test2.ll +++ b/test/Transforms/IndVarSimplify/exit_value_test2.ll @@ -3,15 +3,14 @@ ; Check IndVarSimplify should not replace exit value because or else ; udiv will be introduced by expand and the cost will be high. -; -; CHECK-LABEL: @_Z3fooPKcjj( -; CHECK-NOT: udiv declare void @_Z3mixRjj(i32* dereferenceable(4), i32) declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) define i32 @_Z3fooPKcjj(i8* nocapture readonly %s, i32 %len, i32 %c) { +; CHECK-LABEL: @_Z3fooPKcjj( +; CHECK-NOT: udiv entry: %a = alloca i32, align 4 %tmp = bitcast i32* %a to i8* @@ -50,3 +49,26 @@ while.end: ; preds = %while.cond.while.en call void @llvm.lifetime.end.p0i8(i64 4, i8* %tmp) ret i32 %tmp4 } + +define i32 @zero_backedge_count_test(i32 %unknown_init, i32* %unknown_mem) { +; CHECK-LABEL: @zero_backedge_count_test( +entry: + br label %loop + +loop: + %iv = phi i32 [ 0, %entry], [ %iv.inc, %loop ] + %unknown_phi = phi i32 [ %unknown_init, %entry ], [ %unknown_next, %loop ] + %iv.inc = add i32 %iv, 1 + %be_taken = icmp ne i32 %iv.inc, 1 + %unknown_next = load volatile i32, i32* %unknown_mem + br i1 %be_taken, label %loop, label %leave + +leave: +; We can fold %unknown_phi even though the backedge value for it is completely +; unknown, since we can prove that the loop's backedge taken count is 0. + +; CHECK: leave: +; CHECK: ret i32 %unknown_init + %exit_val = phi i32 [ %unknown_phi, %loop ] + ret i32 %exit_val +} diff --git a/test/Transforms/SimplifyCFG/pr34131.ll b/test/Transforms/SimplifyCFG/pr34131.ll new file mode 100644 index 000000000000..b64b6876e04e --- /dev/null +++ b/test/Transforms/SimplifyCFG/pr34131.ll @@ -0,0 +1,74 @@ +; RUN: opt -simplifycfg -S < %s | FileCheck %s + +; Just checking for lack of crash here, but we should be able to check the IR? +; Earlier version using auto-generated checks from utils/update_test_checks.py +; had bot problems though... + +define void @patatino() { + +; CHECK-LABEL: @patatino + + br label %bb1 +bb1: ; preds = %bb36, %0 + br label %bb2 +bb2: ; preds = %bb3, %bb1 + br i1 undef, label %bb4, label %bb3 +bb3: ; preds = %bb4, %bb2 + br i1 undef, label %bb2, label %bb5 +bb4: ; preds = %bb2 + switch i32 undef, label %bb3 [ + ] +bb5: ; preds = %bb3 + br label %bb6 +bb6: ; preds = %bb5 + br i1 undef, label %bb7, label %bb9 +bb7: ; preds = %bb6 + %tmp = or i64 undef, 1 + %tmp8 = icmp ult i64 %tmp, 0 + br i1 %tmp8, label %bb12, label %bb9 +bb9: ; preds = %bb35, %bb34, %bb33, %bb32, %bb31, %bb30, %bb27, %bb24, %bb21, %bb18, %bb16, %bb14, %bb12, %bb7, %bb6 + br label %bb11 +bb10: ; preds = %bb36 + br label %bb11 +bb11: ; preds = %bb10, %bb9 + ret void +bb12: ; preds = %bb7 + %tmp13 = icmp ult i64 0, 0 + br i1 %tmp13, label %bb14, label %bb9 +bb14: ; preds = %bb12 + %tmp15 = icmp ult i64 undef, 0 + br i1 %tmp15, label %bb16, label %bb9 +bb16: ; preds = %bb14 + %tmp17 = icmp ult i64 undef, 0 + br i1 %tmp17, label %bb18, label %bb9 +bb18: ; preds = %bb16 + %tmp19 = or i64 undef, 5 + %tmp20 = icmp ult i64 %tmp19, 0 + br i1 %tmp20, label %bb21, label %bb9 +bb21: ; preds = %bb18 + %tmp22 = or i64 undef, 6 + %tmp23 = icmp ult i64 %tmp22, 0 + br i1 %tmp23, label %bb24, label %bb9 +bb24: ; preds = %bb21 + %tmp25 = or i64 undef, 7 + %tmp26 = icmp ult i64 %tmp25, 0 + br i1 %tmp26, label %bb27, label %bb9 +bb27: ; preds = %bb24 + %tmp28 = or i64 undef, 8 + %tmp29 = icmp ult i64 %tmp28, 0 + br i1 %tmp29, label %bb30, label %bb9 +bb30: ; preds = %bb27 + br i1 undef, label %bb31, label %bb9 +bb31: ; preds = %bb30 + br i1 undef, label %bb32, label %bb9 +bb32: ; preds = %bb31 + br i1 undef, label %bb33, label %bb9 +bb33: ; preds = %bb32 + br i1 undef, label %bb34, label %bb9 +bb34: ; preds = %bb33 + br i1 undef, label %bb35, label %bb9 +bb35: ; preds = %bb34 + br i1 undef, label %bb36, label %bb9 +bb36: ; preds = %bb35 + br i1 undef, label %bb1, label %bb10 +} diff --git a/tools/llvm-objdump/llvm-objdump.cpp b/tools/llvm-objdump/llvm-objdump.cpp index d54b45515f05..74593e6202aa 100644 --- a/tools/llvm-objdump/llvm-objdump.cpp +++ b/tools/llvm-objdump/llvm-objdump.cpp @@ -871,7 +871,7 @@ static void printRelocationTargetName(const MachOObjectFile *O, uint64_t Val = O->getPlainRelocationSymbolNum(RE); if (O->getAnyRelocationType(RE) == MachO::ARM64_RELOC_ADDEND) { - fmt << format("0x%x", Val); + fmt << format("0x%0" PRIx64, Val); return; } else if (isExtern) { symbol_iterator SI = O->symbol_begin(); diff --git a/utils/lit/lit/LitConfig.py b/utils/lit/lit/LitConfig.py index 2ef0a8f77ec9..3351ebed54bd 100644 --- a/utils/lit/lit/LitConfig.py +++ b/utils/lit/lit/LitConfig.py @@ -25,7 +25,7 @@ def __init__(self, progname, path, quiet, params, config_prefix = None, maxIndividualTestTime = 0, maxFailures = None, - parallelism_groups = [], + parallelism_groups = {}, echo_all_commands = False): # The name of the test runner. self.progname = progname diff --git a/utils/lit/lit/TestRunner.py b/utils/lit/lit/TestRunner.py index 46bcac4b306e..a60a0f854870 100644 --- a/utils/lit/lit/TestRunner.py +++ b/utils/lit/lit/TestRunner.py @@ -313,7 +313,7 @@ def processRedirects(cmd, stdin_source, cmd_shenv, opened_files): elif op == ('<',): redirects[0] = [filename, 'r', None] else: - raise InternalShellError(cmd, "Unsupported redirect: %r" % (r,)) + raise InternalShellError(cmd, "Unsupported redirect: %r" % ((op, filename),)) # Open file descriptors in a second pass. std_fds = [None, None, None] diff --git a/utils/lit/lit/formats/__init__.py b/utils/lit/lit/formats/__init__.py index 7d14ca4b535a..3ff46e93ead2 100644 --- a/utils/lit/lit/formats/__init__.py +++ b/utils/lit/lit/formats/__init__.py @@ -1,3 +1,8 @@ -from lit.formats.base import TestFormat # noqa: F401 +from lit.formats.base import ( # noqa: F401 + TestFormat, + FileBasedTest, + OneCommandPerFileTest +) + from lit.formats.googletest import GoogleTest # noqa: F401 from lit.formats.shtest import ShTest # noqa: F401 diff --git a/utils/lit/lit/formats/base.py b/utils/lit/lit/formats/base.py index baa9ff1d3b7d..6721d17e334e 100644 --- a/utils/lit/lit/formats/base.py +++ b/utils/lit/lit/formats/base.py @@ -1,50 +1,117 @@ -import abc +from __future__ import absolute_import +import os + +import lit.Test +import lit.util class TestFormat(object): - """Base class for test formats. + pass - A TestFormat encapsulates logic for finding and executing a certain type of - test. For example, a subclass FooTestFormat would contain the logic for - finding tests written in the 'Foo' format, and the logic for running a - single one. +### - TestFormat is an Abstract Base Class (ABC). It uses the Python abc.ABCMeta - type and associated @abc.abstractmethod decorator. Together, these provide - subclass behaviour which is notionally similar to C++ pure virtual classes: - only subclasses which implement all abstract methods can be instantiated - (the implementation may come from an intermediate base). +class FileBasedTest(TestFormat): + def getTestsInDirectory(self, testSuite, path_in_suite, + litConfig, localConfig): + source_path = testSuite.getSourcePath(path_in_suite) + for filename in os.listdir(source_path): + # Ignore dot files and excluded tests. + if (filename.startswith('.') or + filename in localConfig.excludes): + continue - For details on ABCs, see: https://docs.python.org/2/library/abc.html. Note - that Python ABCs have extensive abilities beyond what is used here. For - TestFormat, we only care about enforcing that abstract methods are - implemented. - """ + filepath = os.path.join(source_path, filename) + if not os.path.isdir(filepath): + base,ext = os.path.splitext(filename) + if ext in localConfig.suffixes: + yield lit.Test.Test(testSuite, path_in_suite + (filename,), + localConfig) - __metaclass__ = abc.ABCMeta +### - @abc.abstractmethod - def getTestsInDirectory(self, testSuite, path_in_suite, litConfig, - localConfig): - """Finds tests of this format in the given directory. +import re +import tempfile - Args: - testSuite: a Test.TestSuite object. - path_in_suite: the subpath under testSuite to look for tests. - litConfig: the LitConfig for the test suite. - localConfig: a LitConfig with local specializations. +class OneCommandPerFileTest(TestFormat): + # FIXME: Refactor into generic test for running some command on a directory + # of inputs. - Returns: - An iterable of Test.Test objects. - """ + def __init__(self, command, dir, recursive=False, + pattern=".*", useTempInput=False): + if isinstance(command, str): + self.command = [command] + else: + self.command = list(command) + if dir is not None: + dir = str(dir) + self.dir = dir + self.recursive = bool(recursive) + self.pattern = re.compile(pattern) + self.useTempInput = useTempInput + + def getTestsInDirectory(self, testSuite, path_in_suite, + litConfig, localConfig): + dir = self.dir + if dir is None: + dir = testSuite.getSourcePath(path_in_suite) + + for dirname,subdirs,filenames in os.walk(dir): + if not self.recursive: + subdirs[:] = [] + + subdirs[:] = [d for d in subdirs + if (d != '.svn' and + d not in localConfig.excludes)] + + for filename in filenames: + if (filename.startswith('.') or + not self.pattern.match(filename) or + filename in localConfig.excludes): + continue + + path = os.path.join(dirname,filename) + suffix = path[len(dir):] + if suffix.startswith(os.sep): + suffix = suffix[1:] + test = lit.Test.Test( + testSuite, path_in_suite + tuple(suffix.split(os.sep)), + localConfig) + # FIXME: Hack? + test.source_path = path + yield test + + def createTempInput(self, tmp, test): + raise NotImplementedError('This is an abstract method.') - @abc.abstractmethod def execute(self, test, litConfig): - """Runs the given 'test', which is of this format. + if test.config.unsupported: + return (lit.Test.UNSUPPORTED, 'Test is unsupported') - Args: - test: a Test.Test object describing the test to run. - litConfig: the LitConfig for the test suite. + cmd = list(self.command) - Returns: - A tuple of (status:Test.ResultCode, message:str) - """ + # If using temp input, create a temporary file and hand it to the + # subclass. + if self.useTempInput: + tmp = tempfile.NamedTemporaryFile(suffix='.cpp') + self.createTempInput(tmp, test) + tmp.flush() + cmd.append(tmp.name) + elif hasattr(test, 'source_path'): + cmd.append(test.source_path) + else: + cmd.append(test.getSourcePath()) + + out, err, exitCode = lit.util.executeCommand(cmd) + + diags = out + err + if not exitCode and not diags.strip(): + return lit.Test.PASS,'' + + # Try to include some useful information. + report = """Command: %s\n""" % ' '.join(["'%s'" % a + for a in cmd]) + if self.useTempInput: + report += """Temporary File: %s\n""" % tmp.name + report += "--\n%s--\n""" % open(tmp.name).read() + report += """Output:\n--\n%s--""" % diags + + return lit.Test.FAIL, report diff --git a/utils/lit/lit/formats/shtest.py b/utils/lit/lit/formats/shtest.py index 01ecd192092e..fdc9bd0241f3 100644 --- a/utils/lit/lit/formats/shtest.py +++ b/utils/lit/lit/formats/shtest.py @@ -1,13 +1,12 @@ from __future__ import absolute_import -import os - -import lit.Test import lit.TestRunner import lit.util -from .base import TestFormat -class ShTest(TestFormat): +from .base import FileBasedTest + + +class ShTest(FileBasedTest): """ShTest is a format with one file per test. This is the primary format for regression tests as described in the LLVM @@ -18,31 +17,9 @@ class ShTest(TestFormat): The ShTest files contain some number of shell-like command pipelines, along with assertions about what should be in the output. """ - - def __init__(self, execute_external = False): - """Initializer. - - The 'execute_external' argument controls whether lit uses its internal - logic for command pipelines, or passes the command to a shell - subprocess. - - Args: - execute_external: (optional) If true, use shell subprocesses instead - of lit's internal pipeline logic. - """ + def __init__(self, execute_external=False): self.execute_external = execute_external - def getTestsInDirectory(self, testSuite, path_in_suite, - litConfig, localConfig): - """Yields test files matching 'suffixes' from the localConfig.""" - file_matches = lit.util.listdir_files( - testSuite.getSourcePath(path_in_suite), - localConfig.suffixes, localConfig.excludes) - for filename in file_matches: - yield lit.Test.Test(testSuite, path_in_suite + (filename,), - localConfig) - def execute(self, test, litConfig): - """Interprets and runs the given test file, and returns the result.""" return lit.TestRunner.executeShTest(test, litConfig, self.execute_external) diff --git a/utils/lit/lit/run.py b/utils/lit/lit/run.py index 1290c142c834..3e39bdb92203 100644 --- a/utils/lit/lit/run.py +++ b/utils/lit/lit/run.py @@ -44,6 +44,12 @@ class Run(object): def __init__(self, lit_config, tests): self.lit_config = lit_config self.tests = tests + # Set up semaphores to limit parallelism of certain classes of tests. + # For example, some ASan tests require lots of virtual memory and run + # faster with less parallelism on OS X. + self.parallelism_semaphores = \ + {k: multiprocessing.Semaphore(v) for k, v in + self.lit_config.parallelism_groups.items()} def execute_test(self, test): return _execute_test_impl(test, self.lit_config, @@ -74,13 +80,6 @@ def execute_tests(self, display, jobs, max_time=None): if not self.tests or jobs == 0: return - # Set up semaphores to limit parallelism of certain classes of tests. - # For example, some ASan tests require lots of virtual memory and run - # faster with less parallelism on OS X. - self.parallelism_semaphores = \ - {k: multiprocessing.Semaphore(v) for k, v in - self.lit_config.parallelism_groups.items()} - # Install a console-control signal handler on Windows. if win32api is not None: def console_ctrl_handler(type): diff --git a/utils/lit/tests/Inputs/max-failures/lit.cfg b/utils/lit/tests/Inputs/max-failures/lit.cfg new file mode 100644 index 000000000000..50d07566e1cc --- /dev/null +++ b/utils/lit/tests/Inputs/max-failures/lit.cfg @@ -0,0 +1,6 @@ +import lit.formats +config.name = 'shtest-shell' +config.suffixes = ['.txt'] +config.test_format = lit.formats.ShTest() +config.test_source_root = os.path.dirname(__file__) + '/../shtest-shell' +config.test_exec_root = None diff --git a/utils/lit/tests/max-failures.py b/utils/lit/tests/max-failures.py index 5cc258dd08aa..bc58e9a4e47f 100644 --- a/utils/lit/tests/max-failures.py +++ b/utils/lit/tests/max-failures.py @@ -1,9 +1,9 @@ # Check the behavior of --max-failures option. # -# RUN: not %{lit} -j 1 -v %{inputs}/shtest-shell > %t.out -# RUN: not %{lit} --max-failures=1 -j 1 -v %{inputs}/shtest-shell >> %t.out -# RUN: not %{lit} --max-failures=2 -j 1 -v %{inputs}/shtest-shell >> %t.out -# RUN: not %{lit} --max-failures=0 -j 1 -v %{inputs}/shtest-shell 2>> %t.out +# RUN: not %{lit} -j 1 -v %{inputs}/max-failures > %t.out +# RUN: not %{lit} --max-failures=1 -j 1 -v %{inputs}/max-failures >> %t.out +# RUN: not %{lit} --max-failures=2 -j 1 -v %{inputs}/max-failures >> %t.out +# RUN: not %{lit} --max-failures=0 -j 1 -v %{inputs}/max-failures 2>> %t.out # RUN: FileCheck < %t.out %s # # END. diff --git a/utils/lit/tests/selecting.py b/utils/lit/tests/selecting.py index 19ba240f9b0f..4a0d08b860b8 100644 --- a/utils/lit/tests/selecting.py +++ b/utils/lit/tests/selecting.py @@ -9,7 +9,7 @@ # Check that regex-filtering based on environment variables work. # -# RUN: LIT_FILTER='o[a-z]e' %{lit} %{inputs}/discovery | FileCheck --check-prefix=CHECK-FILTER-ENV %s +# RUN: env LIT_FILTER='o[a-z]e' %{lit} %{inputs}/discovery | FileCheck --check-prefix=CHECK-FILTER-ENV %s # CHECK-FILTER-ENV: Testing: 2 of 5 tests diff --git a/utils/release/test-release.sh b/utils/release/test-release.sh index 02d8e7925f6e..66a2c578083e 100755 --- a/utils/release/test-release.sh +++ b/utils/release/test-release.sh @@ -403,14 +403,6 @@ function test_llvmCore() { fi if [ $do_test_suite = 'yes' ]; then - SandboxDir="$BuildDir/sandbox" - Lit=$SandboxDir/bin/lit - TestSuiteBuildDir="$BuildDir/test-suite-build" - TestSuiteSrcDir="$BuildDir/test-suite.src" - - virtualenv $SandboxDir - $SandboxDir/bin/python $BuildDir/llvm.src/utils/lit/setup.py install - mkdir -p $TestSuiteBuildDir cd $TestSuiteBuildDir env CC="$c_compiler" CXX="$cxx_compiler" \ cmake $TestSuiteSrcDir -DTEST_SUITE_LIT=$Lit @@ -466,6 +458,19 @@ if [ "$do_checkout" = "yes" ]; then export_sources fi +# Setup the test-suite. Do this early so we can catch failures before +# we do the full 3 stage build. +if [ $do_test_suite = "yes" ]; then + SandboxDir="$BuildDir/sandbox" + Lit=$SandboxDir/bin/lit + TestSuiteBuildDir="$BuildDir/test-suite-build" + TestSuiteSrcDir="$BuildDir/test-suite.src" + + virtualenv $SandboxDir + $SandboxDir/bin/python $BuildDir/llvm.src/utils/lit/setup.py install + mkdir -p $TestSuiteBuildDir +fi + ( Flavors="Release" if [ "$do_debug" = "yes" ]; then From 6aa46a19c56750e17f7acedc47d95111fd2dcd5d Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 20 Aug 2017 21:03:30 +0000 Subject: [PATCH 2/4] Vendor import of clang release_50 branch r311219: https://llvm.org/svn/llvm-project/cfe/branches/release_50@311219 --- docs/ReleaseNotes.rst | 22 +- include/clang-c/Index.h | 2 + include/clang/AST/Decl.h | 3 +- include/clang/Basic/DiagnosticDriverKinds.td | 5 +- include/clang/Basic/DiagnosticGroups.td | 16 +- include/clang/Basic/DiagnosticLexKinds.td | 6 +- include/clang/Basic/DiagnosticParseKinds.td | 50 ++-- include/clang/Basic/DiagnosticSemaKinds.td | 40 +-- include/clang/Driver/Options.td | 4 + include/clang/Driver/ToolChain.h | 2 +- include/clang/Frontend/LangStandards.def | 10 +- lib/AST/DeclCXX.cpp | 5 +- lib/AST/ExprCXX.cpp | 4 +- lib/AST/ExprConstant.cpp | 2 + lib/Basic/Targets.cpp | 8 +- lib/CodeGen/TargetInfo.cpp | 25 +- lib/Driver/ToolChain.cpp | 2 +- lib/Driver/ToolChains/Arch/Mips.cpp | 2 + lib/Driver/ToolChains/Clang.cpp | 2 +- lib/Driver/ToolChains/CrossWindows.cpp | 2 +- lib/Driver/ToolChains/CrossWindows.h | 2 +- lib/Driver/ToolChains/Darwin.cpp | 44 ++-- lib/Driver/ToolChains/Darwin.h | 2 +- lib/Driver/ToolChains/Gnu.cpp | 2 +- lib/Driver/ToolChains/Gnu.h | 2 +- lib/Driver/ToolChains/MSVC.cpp | 2 +- lib/Driver/ToolChains/MSVC.h | 2 +- lib/Driver/ToolChains/MinGW.cpp | 2 +- lib/Driver/ToolChains/MinGW.h | 2 +- lib/Driver/ToolChains/NetBSD.h | 5 +- lib/Frontend/InitPreprocessor.cpp | 5 +- lib/Parse/ParseCXXInlineMethods.cpp | 23 +- lib/Sema/SemaCast.cpp | 9 +- lib/Sema/SemaCodeComplete.cpp | 5 +- lib/Sema/SemaDecl.cpp | 21 +- lib/Sema/SemaTemplateInstantiateDecl.cpp | 2 + .../dcl.attr/dcl.attr.nodiscard/p2.cpp | 10 +- .../dcl.dcl/dcl.attr/dcl.attr.unused/p3.cpp | 10 +- test/CXX/drs/dr0xx.cpp | 20 +- test/CXX/drs/dr13xx.cpp | 18 +- test/CXX/drs/dr1xx.cpp | 4 +- test/CXX/drs/dr20xx.cpp | 2 +- test/CXX/drs/dr2xx.cpp | 8 +- test/CXX/drs/dr4xx.cpp | 10 +- test/CXX/drs/dr5xx.cpp | 4 +- .../stmt.stmt/stmt.iter/stmt.ranged/p1.cpp | 4 +- test/CodeCompletion/uninstantiated_params.cpp | 13 + test/CodeGen/arm-float-helpers.c | 233 ++++++++++++++++++ test/CodeGen/complex-math.c | 12 +- test/CodeGen/mips-aggregate-arg.c | 38 --- test/CodeGen/mips-madd4.c | 87 +++++++ test/CodeGenCXX/pr34163.cpp | 13 + test/Driver/clang-translation.c | 8 + test/Driver/darwin-version.c | 6 + test/Driver/unknown-std.cpp | 4 +- test/FixIt/fixit.cpp | 2 +- test/Lexer/cxx-features.cpp | 30 ++- test/Lexer/hexfloat.cpp | 10 +- test/Modules/Inputs/innerstructredef.h | 6 + test/Modules/Inputs/module.map | 9 + .../inner-struct-redefines-invisible.m | 12 + test/Parser/cxx0x-attributes.cpp | 8 +- test/Parser/cxx1z-constexpr-lambdas.cpp | 8 +- .../cxx1z-nested-namespace-definition.cpp | 6 +- test/Preprocessor/init.c | 10 + test/SemaCUDA/function-overload.cu | 2 +- test/SemaCUDA/no-destructor-overload.cu | 10 +- test/SemaCXX/constant-expression-cxx1y.cpp | 6 + test/SemaCXX/cxx0x-compat.cpp | 8 +- ...xx1z-class-template-argument-deduction.cpp | 23 ++ test/SemaCXX/cxx1z-init-statement.cpp | 1 + test/SemaCXX/deprecated.cpp | 16 +- test/SemaCXX/inline.cpp | 6 +- test/SemaCXX/static-assert.cpp | 2 +- test/SemaCXX/warn-c++1z-extensions.cpp | 4 +- test/SemaCXX/warn-shadow.cpp | 9 + test/SemaObjC/illegal-nonarc-bridged-cast.m | 17 +- test/SemaTemplate/temp_arg_nontype_cxx11.cpp | 2 +- www/cxx_dr_status.html | 52 ++-- www/cxx_status.html | 13 +- www/make_cxx_dr_status | 6 +- 81 files changed, 801 insertions(+), 323 deletions(-) create mode 100644 test/CodeCompletion/uninstantiated_params.cpp create mode 100644 test/CodeGen/arm-float-helpers.c delete mode 100644 test/CodeGen/mips-aggregate-arg.c create mode 100644 test/CodeGen/mips-madd4.c create mode 100644 test/CodeGenCXX/pr34163.cpp create mode 100644 test/Modules/Inputs/innerstructredef.h create mode 100644 test/Modules/inner-struct-redefines-invisible.m diff --git a/docs/ReleaseNotes.rst b/docs/ReleaseNotes.rst index deffa24c4e42..982abb024525 100644 --- a/docs/ReleaseNotes.rst +++ b/docs/ReleaseNotes.rst @@ -61,7 +61,7 @@ Improvements to Clang's diagnostics New Compiler Flags ------------------ -The option .... +- --autocomplete was implemented to obtain a list of flags and its arguments. This is used for shell autocompletion. Deprecated Compiler Flags ------------------------- @@ -200,7 +200,13 @@ libclang Static Analyzer --------------- -... +- The static analyzer now supports using the + `z3 theorem prover `_ from Microsoft Research + as an external constraint solver. This allows reasoning over more complex + queries, but performance is ~15x slower than the default range-based + constraint solver. To enable the z3 solver backend, clang must be built with + the ``CLANG_ANALYZER_BUILD_Z3=ON`` option, and the + ``-Xanalyzer -analyzer-constraints=z3`` arguments passed at runtime. Undefined Behavior Sanitizer (UBSan) ------------------------------------ @@ -240,8 +246,20 @@ New Issues Found Python Binding Changes ---------------------- +Python bindings now support both Python 2 and Python 3. + The following methods have been added: +- ``is_scoped_enum`` has been added to ``Cursor``. + +- ``exception_specification_kind`` has been added to ``Cursor``. + +- ``get_address_space`` has been added to ``Type``. + +- ``get_typedef_name`` has been added to ``Type``. + +- ``get_exception_specification_kind`` has been added to ``Type``. + - ... Significant Known Problems diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h index b35f436e91b6..3b5ea9fa539b 100644 --- a/include/clang-c/Index.h +++ b/include/clang-c/Index.h @@ -3206,6 +3206,8 @@ enum CXCallingConv { CXCallingConv_X86RegCall = 8, CXCallingConv_IntelOclBicc = 9, CXCallingConv_Win64 = 10, + /* Alias for compatibility with older versions of API. */ + CXCallingConv_X86_64Win64 = CXCallingConv_Win64, CXCallingConv_X86_64SysV = 11, CXCallingConv_X86VectorCall = 12, CXCallingConv_Swift = 13, diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index 08b34a75aa60..54e6ebcd8af2 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -1666,8 +1666,7 @@ class FunctionDecl : public DeclaratorDecl, public DeclContext, unsigned HasSkippedBody : 1; /// Indicates if the function declaration will have a body, once we're done - /// parsing it. (We don't set it to false when we're done parsing, in the - /// hopes this is simpler.) + /// parsing it. unsigned WillHaveBody : 1; /// \brief End part of this FunctionDecl's source range. diff --git a/include/clang/Basic/DiagnosticDriverKinds.td b/include/clang/Basic/DiagnosticDriverKinds.td index a28d63182749..fcef881fa0ae 100644 --- a/include/clang/Basic/DiagnosticDriverKinds.td +++ b/include/clang/Basic/DiagnosticDriverKinds.td @@ -138,9 +138,10 @@ def err_drv_cc_print_options_failure : Error< def err_drv_lto_without_lld : Error<"LTO requires -fuse-ld=lld">; def err_drv_preamble_format : Error< "incorrect format for -preamble-bytes=N,END">; -def err_invalid_ios_deployment_target : Error< +def warn_invalid_ios_deployment_target : Warning< "invalid iOS deployment version '%0', iOS 10 is the maximum deployment " - "target for 32-bit targets">; + "target for 32-bit targets">, InGroup, + DefaultError; def err_drv_conflicting_deployment_targets : Error< "conflicting deployment targets, both '%0' and '%1' are present in environment">; def err_arc_unsupported_on_runtime : Error< diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td index 53d8f36ecd00..23e4d4633ae2 100644 --- a/include/clang/Basic/DiagnosticGroups.td +++ b/include/clang/Basic/DiagnosticGroups.td @@ -151,9 +151,13 @@ def GNUFlexibleArrayUnionMember : DiagGroup<"gnu-flexible-array-union-member">; def GNUFoldingConstant : DiagGroup<"gnu-folding-constant">; def FormatExtraArgs : DiagGroup<"format-extra-args">; def FormatZeroLength : DiagGroup<"format-zero-length">; -def CXX1zCompatMangling : DiagGroup<"c++1z-compat-mangling">; + +def InvalidIOSDeploymentTarget : DiagGroup<"invalid-ios-deployment-target">; + +def CXX17CompatMangling : DiagGroup<"c++17-compat-mangling">; +def : DiagGroup<"c++1z-compat-mangling", [CXX17CompatMangling]>; // Name of this warning in GCC. -def NoexceptType : DiagGroup<"noexcept-type", [CXX1zCompatMangling]>; +def NoexceptType : DiagGroup<"noexcept-type", [CXX17CompatMangling]>; // Warnings for C++1y code which is not compatible with prior C++ standards. def CXXPre14Compat : DiagGroup<"c++98-c++11-compat">; @@ -215,9 +219,10 @@ def CXX14Compat : DiagGroup<"c++14-compat", [CXXPre1zCompat]>; def CXX14CompatPedantic : DiagGroup<"c++14-compat-pedantic", [CXXPre1zCompatPedantic]>; -def CXX1zCompat : DiagGroup<"c++1z-compat", [DeprecatedRegister, +def CXX17Compat : DiagGroup<"c++17-compat", [DeprecatedRegister, DeprecatedIncrementBool, - CXX1zCompatMangling]>; + CXX17CompatMangling]>; +def : DiagGroup<"c++1z-compat", [CXX17Compat]>; def ExitTimeDestructors : DiagGroup<"exit-time-destructors">; def FlexibleArrayExtensions : DiagGroup<"flexible-array-extensions">; @@ -769,10 +774,11 @@ def CXX14 : DiagGroup<"c++14-extensions", [CXX14BinaryLiteral]>; // A warning group for warnings about using C++1z features as extensions in // earlier C++ versions. -def CXX1z : DiagGroup<"c++1z-extensions">; +def CXX17 : DiagGroup<"c++17-extensions">; def : DiagGroup<"c++0x-extensions", [CXX11]>; def : DiagGroup<"c++1y-extensions", [CXX14]>; +def : DiagGroup<"c++1z-extensions", [CXX17]>; def DelegatingCtorCycles : DiagGroup<"delegating-ctor-cycles">; diff --git a/include/clang/Basic/DiagnosticLexKinds.td b/include/clang/Basic/DiagnosticLexKinds.td index d6de5c04a74d..706881bfdc5d 100644 --- a/include/clang/Basic/DiagnosticLexKinds.td +++ b/include/clang/Basic/DiagnosticLexKinds.td @@ -181,10 +181,10 @@ def err_hex_constant_requires : Error< def ext_hex_constant_invalid : Extension< "hexadecimal floating constants are a C99 feature">, InGroup; def ext_hex_literal_invalid : Extension< - "hexadecimal floating literals are a C++1z feature">, InGroup; + "hexadecimal floating literals are a C++17 feature">, InGroup; def warn_cxx1z_hex_literal : Warning< "hexadecimal floating literals are incompatible with " - "C++ standards before C++1z">, + "C++ standards before C++17">, InGroup, DefaultIgnore; def ext_binary_literal : Extension< "binary integer literals are a GNU extension">, InGroup; @@ -208,7 +208,7 @@ def warn_cxx98_compat_unicode_literal : Warning< "unicode literals are incompatible with C++98">, InGroup, DefaultIgnore; def warn_cxx14_compat_u8_character_literal : Warning< - "unicode literals are incompatible with C++ standards before C++1z">, + "unicode literals are incompatible with C++ standards before C++17">, InGroup, DefaultIgnore; def warn_cxx11_compat_user_defined_literal : Warning< "identifier after literal will be treated as a user-defined literal suffix " diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td index f39ffeae61f4..5170c07bf666 100644 --- a/include/clang/Basic/DiagnosticParseKinds.td +++ b/include/clang/Basic/DiagnosticParseKinds.td @@ -211,10 +211,10 @@ def err_inline_namespace_alias : Error<"namespace alias cannot be inline">; def err_namespace_nonnamespace_scope : Error< "namespaces can only be defined in global or namespace scope">; def ext_nested_namespace_definition : ExtWarn< - "nested namespace definition is a C++1z extension; " - "define each namespace separately">, InGroup; + "nested namespace definition is a C++17 extension; " + "define each namespace separately">, InGroup; def warn_cxx14_compat_nested_namespace_definition : Warning< - "nested namespace definition is incompatible with C++ standards before C++1z">, + "nested namespace definition is incompatible with C++ standards before C++17">, InGroup, DefaultIgnore; def err_inline_nested_namespace_definition : Error< "nested namespace definition cannot be 'inline'">; @@ -358,7 +358,7 @@ def err_expected_coloncolon_after_super : Error< "expected '::' after '__super'">; def ext_decomp_decl_empty : ExtWarn< - "ISO C++1z does not allow a decomposition group to be empty">, + "ISO C++17 does not allow a decomposition group to be empty">, InGroup>; /// Objective-C parser diagnostics @@ -522,16 +522,16 @@ def err_function_is_not_record : Error< def err_super_in_using_declaration : Error< "'__super' cannot be used with a using declaration">; def ext_constexpr_if : ExtWarn< - "constexpr if is a C++1z extension">, InGroup; + "constexpr if is a C++17 extension">, InGroup; def warn_cxx14_compat_constexpr_if : Warning< - "constexpr if is incompatible with C++ standards before C++1z">, + "constexpr if is incompatible with C++ standards before C++17">, DefaultIgnore, InGroup; def ext_init_statement : ExtWarn< - "'%select{if|switch}0' initialization statements are a C++1z extension">, - InGroup; + "'%select{if|switch}0' initialization statements are a C++17 extension">, + InGroup; def warn_cxx14_compat_init_statement : Warning< "%select{if|switch}0 initialization statements are incompatible with " - "C++ standards before C++1z">, DefaultIgnore, InGroup; + "C++ standards before C++17">, DefaultIgnore, InGroup; // C++ derived classes def err_dup_virtual : Error<"duplicate 'virtual' in base specifier">; @@ -560,7 +560,7 @@ def warn_cxx98_compat_nullptr : Warning< def warn_cxx14_compat_attribute : Warning< "attributes on %select{a namespace|an enumerator}0 declaration are " - "incompatible with C++ standards before C++1z">, + "incompatible with C++ standards before C++17">, InGroup, DefaultIgnore; def warn_cxx98_compat_alignas : Warning<"'alignas' is incompatible with C++98">, InGroup, DefaultIgnore; @@ -577,10 +577,10 @@ def err_cxx11_attribute_repeated : Error< "attribute %0 cannot appear multiple times in an attribute specifier">; def warn_cxx14_compat_using_attribute_ns : Warning< "default scope specifier for attributes is incompatible with C++ standards " - "before C++1z">, InGroup, DefaultIgnore; + "before C++17">, InGroup, DefaultIgnore; def ext_using_attribute_ns : ExtWarn< - "default scope specifier for attributes is a C++1z extension">, - InGroup; + "default scope specifier for attributes is a C++17 extension">, + InGroup; def err_using_attribute_ns_conflict : Error< "attribute with scope specifier cannot follow default scope specifier">; def err_attributes_not_allowed : Error<"an attribute list cannot appear here">; @@ -617,11 +617,11 @@ def err_expected_comma_greater : Error< def err_class_on_template_template_param : Error< "template template parameter requires 'class' after the parameter list">; def ext_template_template_param_typename : ExtWarn< - "template template parameter using 'typename' is a C++1z extension">, - InGroup; + "template template parameter using 'typename' is a C++17 extension">, + InGroup; def warn_cxx14_compat_template_template_param_typename : Warning< "template template parameter using 'typename' is " - "incompatible with C++ standards before C++1z">, + "incompatible with C++ standards before C++17">, InGroup, DefaultIgnore; def err_template_spec_syntax_non_template : Error< "identifier followed by '<' indicates a class template specialization but " @@ -695,10 +695,10 @@ def err_default_template_template_parameter_not_template : Error< "template">; def ext_fold_expression : ExtWarn< - "pack fold expression is a C++1z extension">, - InGroup; + "pack fold expression is a C++17 extension">, + InGroup; def warn_cxx14_compat_fold_expression : Warning< - "pack fold expression is incompatible with C++ standards before C++1z">, + "pack fold expression is incompatible with C++ standards before C++17">, InGroup, DefaultIgnore; def err_expected_fold_operator : Error< "expected a foldable binary operator in fold expression">; @@ -751,16 +751,16 @@ def err_alias_declaration_pack_expansion : Error< // C++1z using-declaration pack expansions def ext_multi_using_declaration : ExtWarn< "use of multiple declarators in a single using declaration is " - "a C++1z extension">, InGroup; + "a C++17 extension">, InGroup; def warn_cxx1z_compat_multi_using_declaration : Warning< "use of multiple declarators in a single using declaration is " - "incompatible with C++ standards before C++1z">, + "incompatible with C++ standards before C++17">, InGroup, DefaultIgnore; def ext_using_declaration_pack : ExtWarn< - "pack expansion of using declaration is a C++1z extension">, InGroup; + "pack expansion of using declaration is a C++17 extension">, InGroup; def warn_cxx1z_compat_using_declaration_pack : Warning< "pack expansion using declaration is incompatible with C++ standards " - "before C++1z">, InGroup, DefaultIgnore; + "before C++17">, InGroup, DefaultIgnore; // C++11 override control def ext_override_control_keyword : ExtWarn< @@ -817,10 +817,10 @@ def err_expected_star_this_capture : Error< // C++1z constexpr lambda expressions def warn_cxx14_compat_constexpr_on_lambda : Warning< - "constexpr on lambda expressions is incompatible with C++ standards before C++1z">, + "constexpr on lambda expressions is incompatible with C++ standards before C++17">, InGroup, DefaultIgnore; def ext_constexpr_on_lambda_cxx1z : ExtWarn< - "'constexpr' on lambda expressions is a C++1z extension">, InGroup; + "'constexpr' on lambda expressions is a C++17 extension">, InGroup; // Availability attribute def err_expected_version : Error< diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index af14638e1d61..6456913a1549 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -211,9 +211,9 @@ def warn_auto_storage_class : Warning< def warn_deprecated_register : Warning< "'register' storage class specifier is deprecated " - "and incompatible with C++1z">, InGroup; + "and incompatible with C++17">, InGroup; def ext_register_storage_class : ExtWarn< - "ISO C++1z does not allow 'register' storage class specifier">, + "ISO C++17 does not allow 'register' storage class specifier">, DefaultError, InGroup; def err_invalid_decl_spec_combination : Error< @@ -391,9 +391,9 @@ def err_decomp_decl_context : Error< "decomposition declaration not permitted in this context">; def warn_cxx14_compat_decomp_decl : Warning< "decomposition declarations are incompatible with " - "C++ standards before C++1z">, DefaultIgnore, InGroup; + "C++ standards before C++17">, DefaultIgnore, InGroup; def ext_decomp_decl : ExtWarn< - "decomposition declarations are a C++1z extension">, InGroup; + "decomposition declarations are a C++17 extension">, InGroup; def err_decomp_decl_spec : Error< "decomposition declaration cannot be declared " "%plural{1:'%1'|:with '%1' specifiers}0">; @@ -494,7 +494,7 @@ def err_access_decl : Error< "ISO C++11 does not allow access declarations; " "use using declarations instead">; def ext_dynamic_exception_spec : ExtWarn< - "ISO C++1z does not allow dynamic exception specifications">, + "ISO C++17 does not allow dynamic exception specifications">, InGroup, DefaultError; def warn_exception_spec_deprecated : Warning< "dynamic exception specifications are deprecated">, @@ -507,7 +507,7 @@ def warn_deprecated_copy_operation : Warning< InGroup, DefaultIgnore; def warn_cxx1z_compat_exception_spec_in_signature : Warning< "mangled name of %0 will change in C++17 due to non-throwing exception " - "specification in function signature">, InGroup; + "specification in function signature">, InGroup; def warn_global_constructor : Warning< "declaration requires a global constructor">, @@ -1200,15 +1200,15 @@ def err_static_assert_expression_is_not_constant : Error< "static_assert expression is not an integral constant expression">; def err_static_assert_failed : Error<"static_assert failed%select{ %1|}0">; def ext_static_assert_no_message : ExtWarn< - "static_assert with no message is a C++1z extension">, InGroup; + "static_assert with no message is a C++17 extension">, InGroup; def warn_cxx14_compat_static_assert_no_message : Warning< - "static_assert with no message is incompatible with C++ standards before C++1z">, + "static_assert with no message is incompatible with C++ standards before C++17">, DefaultIgnore, InGroup; def ext_inline_variable : ExtWarn< - "inline variables are a C++1z extension">, InGroup; + "inline variables are a C++17 extension">, InGroup; def warn_cxx14_compat_inline_variable : Warning< - "inline variables are incompatible with C++ standards before C++1z">, + "inline variables are incompatible with C++ standards before C++17">, DefaultIgnore, InGroup; def warn_inline_namespace_reopened_noninline : Warning< @@ -1922,7 +1922,7 @@ def err_auto_not_allowed : Error< "|in non-static struct member|in struct member" "|in non-static union member|in union member" "|in non-static class member|in interface member" - "|in exception declaration|in template parameter until C++1z|in block literal" + "|in exception declaration|in template parameter until C++17|in block literal" "|in template argument|in typedef|in type alias|in function return type" "|in conversion function type|here|in lambda parameter" "|in type allocated by 'new'|in K&R-style function parameter" @@ -2147,11 +2147,11 @@ def err_for_range_iter_deduction_failure : Error< def err_for_range_member_begin_end_mismatch : Error< "range type %0 has '%select{begin|end}1' member but no '%select{end|begin}1' member">; def ext_for_range_begin_end_types_differ : ExtWarn< - "'begin' and 'end' returning different types (%0 and %1) is a C++1z extension">, - InGroup; + "'begin' and 'end' returning different types (%0 and %1) is a C++17 extension">, + InGroup; def warn_for_range_begin_end_types_differ : Warning< "'begin' and 'end' returning different types (%0 and %1) is incompatible " - "with C++ standards before C++1z">, InGroup, DefaultIgnore; + "with C++ standards before C++17">, InGroup, DefaultIgnore; def note_in_for_range: Note< "when looking up '%select{begin|end}0' function for range expression " "of type %1">; @@ -3905,7 +3905,7 @@ def err_template_nontype_parm_bad_type : Error< "a non-type template parameter cannot have type %0">; def warn_cxx14_compat_template_nontype_parm_auto_type : Warning< "non-type template parameters declared with %0 are incompatible with C++ " - "standards before C++1z">, + "standards before C++17">, DefaultIgnore, InGroup; def err_template_param_default_arg_redefinition : Error< "template parameter redefines default argument">; @@ -6337,9 +6337,9 @@ def note_member_first_declared_here : Note< def err_decrement_bool : Error<"cannot decrement expression of type bool">; def warn_increment_bool : Warning< "incrementing expression of type bool is deprecated and " - "incompatible with C++1z">, InGroup; + "incompatible with C++17">, InGroup; def ext_increment_bool : ExtWarn< - "ISO C++1z does not allow incrementing expression of type bool">, + "ISO C++17 does not allow incrementing expression of type bool">, DefaultError, InGroup; def err_increment_decrement_enum : Error< "cannot %select{decrement|increment}0 expression of enum type %1">; @@ -6528,10 +6528,10 @@ let CategoryName = "Lambda Issue" in { // C++1z '*this' captures. def warn_cxx14_compat_star_this_lambda_capture : Warning< - "by value capture of '*this' is incompatible with C++ standards before C++1z">, + "by value capture of '*this' is incompatible with C++ standards before C++17">, InGroup, DefaultIgnore; def ext_star_this_lambda_capture_cxx1z : ExtWarn< - "capture of '*this' by copy is a C++1z extension">, InGroup; + "capture of '*this' by copy is a C++17 extension">, InGroup; } def err_return_in_captured_stmt : Error< @@ -7200,7 +7200,7 @@ def warn_unused_volatile : Warning< def ext_cxx14_attr : Extension< "use of the %0 attribute is a C++14 extension">, InGroup; def ext_cxx1z_attr : Extension< - "use of the %0 attribute is a C++1z extension">, InGroup; + "use of the %0 attribute is a C++17 extension">, InGroup; def warn_unused_comparison : Warning< "%select{%select{|in}1equality|relational}0 comparison result unused">, diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td index 3c0674f598d1..753c178eec6a 100644 --- a/include/clang/Driver/Options.td +++ b/include/clang/Driver/Options.td @@ -2019,6 +2019,10 @@ def mdspr2 : Flag<["-"], "mdspr2">, Group; def mno_dspr2 : Flag<["-"], "mno-dspr2">, Group; def msingle_float : Flag<["-"], "msingle-float">, Group; def mdouble_float : Flag<["-"], "mdouble-float">, Group; +def mmadd4 : Flag<["-"], "mmadd4">, Group, + HelpText<"Enable the generation of 4-operand madd.s, madd.d and related instructions.">; +def mno_madd4 : Flag<["-"], "mno-madd4">, Group, + HelpText<"Disable the generation of 4-operand madd.s, madd.d and related instructions.">; def mmsa : Flag<["-"], "mmsa">, Group, HelpText<"Enable MSA ASE (MIPS only)">; def mno_msa : Flag<["-"], "mno-msa">, Group, diff --git a/include/clang/Driver/ToolChain.h b/include/clang/Driver/ToolChain.h index eb42f1260d92..6651491e5b27 100644 --- a/include/clang/Driver/ToolChain.h +++ b/include/clang/Driver/ToolChain.h @@ -315,7 +315,7 @@ class ToolChain { /// IsUnwindTablesDefault - Does this tool chain use -funwind-tables /// by default. - virtual bool IsUnwindTablesDefault() const; + virtual bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const; /// \brief Test whether this toolchain defaults to PIC. virtual bool isPICDefault() const = 0; diff --git a/include/clang/Frontend/LangStandards.def b/include/clang/Frontend/LangStandards.def index 669e487023a5..a019d6392214 100644 --- a/include/clang/Frontend/LangStandards.def +++ b/include/clang/Frontend/LangStandards.def @@ -109,15 +109,17 @@ LANGSTANDARD(gnucxx14, "gnu++14", GNUMode) LANGSTANDARD_ALIAS_DEPR(gnucxx14, "gnu++1y") -LANGSTANDARD(cxx1z, "c++1z", - CXX, "Working draft for ISO C++ 2017", +LANGSTANDARD(cxx17, "c++17", + CXX, "ISO C++ 2017 with amendments", LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus1z | Digraphs | HexFloat) +LANGSTANDARD_ALIAS_DEPR(cxx17, "c++1z") -LANGSTANDARD(gnucxx1z, "gnu++1z", - CXX, "Working draft for ISO C++ 2017 with GNU extensions", +LANGSTANDARD(gnucxx17, "gnu++17", + CXX, "ISO C++ 2017 with amendments and GNU extensions", LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus1z | Digraphs | HexFloat | GNUMode) +LANGSTANDARD_ALIAS_DEPR(gnucxx17, "gnu++1z") LANGSTANDARD(cxx2a, "c++2a", CXX, "Working draft for ISO C++ 2020", diff --git a/lib/AST/DeclCXX.cpp b/lib/AST/DeclCXX.cpp index 5cab48882251..1caceab85eea 100644 --- a/lib/AST/DeclCXX.cpp +++ b/lib/AST/DeclCXX.cpp @@ -1837,9 +1837,10 @@ bool CXXMethodDecl::hasInlineBody() const { const FunctionDecl *CheckFn = getTemplateInstantiationPattern(); if (!CheckFn) CheckFn = this; - + const FunctionDecl *fn; - return CheckFn->hasBody(fn) && !fn->isOutOfLine(); + return CheckFn->isDefined(fn) && !fn->isOutOfLine() && + (fn->doesThisDeclarationHaveABody() || fn->willHaveBody()); } bool CXXMethodDecl::isLambdaStaticInvoker() const { diff --git a/lib/AST/ExprCXX.cpp b/lib/AST/ExprCXX.cpp index 6713fca04571..fe45b5e47f36 100644 --- a/lib/AST/ExprCXX.cpp +++ b/lib/AST/ExprCXX.cpp @@ -1052,7 +1052,9 @@ CXXUnresolvedConstructExpr::CXXUnresolvedConstructExpr(TypeSourceInfo *Type, :Type->getType()->isRValueReferenceType()? VK_XValue :VK_RValue), OK_Ordinary, - Type->getType()->isDependentType(), true, true, + Type->getType()->isDependentType() || + Type->getType()->getContainedDeducedType(), + true, true, Type->getType()->containsUnexpandedParameterPack()), Type(Type), LParenLoc(LParenLoc), diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index 0c0c861e5d56..a26b608082f5 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -9788,6 +9788,8 @@ class VoidExprEvaluator bool Success(const APValue &V, const Expr *e) { return true; } + bool ZeroInitialization(const Expr *E) { return true; } + bool VisitCastExpr(const CastExpr *E) { switch (E->getCastKind()) { default: diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index 73be2e173fda..5d75aa5a7528 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -8050,6 +8050,7 @@ class MipsTargetInfo : public TargetInfo { NoDSP, DSP1, DSP2 } DspRev; bool HasMSA; + bool DisableMadd4; protected: bool HasFP64; @@ -8060,7 +8061,7 @@ class MipsTargetInfo : public TargetInfo { : TargetInfo(Triple), IsMips16(false), IsMicromips(false), IsNan2008(false), IsSingleFloat(false), IsNoABICalls(false), CanUseBSDABICalls(false), FloatABI(HardFloat), DspRev(NoDSP), - HasMSA(false), HasFP64(false) { + HasMSA(false), DisableMadd4(false), HasFP64(false) { TheCXXABI.set(TargetCXXABI::GenericMIPS); setABI((getTriple().getArch() == llvm::Triple::mips || @@ -8306,6 +8307,9 @@ class MipsTargetInfo : public TargetInfo { if (HasMSA) Builder.defineMacro("__mips_msa", Twine(1)); + if (DisableMadd4) + Builder.defineMacro("__mips_no_madd4", Twine(1)); + Builder.defineMacro("_MIPS_SZPTR", Twine(getPointerWidth(0))); Builder.defineMacro("_MIPS_SZINT", Twine(getIntWidth())); Builder.defineMacro("_MIPS_SZLONG", Twine(getLongWidth())); @@ -8468,6 +8472,8 @@ class MipsTargetInfo : public TargetInfo { DspRev = std::max(DspRev, DSP2); else if (Feature == "+msa") HasMSA = true; + else if (Feature == "+nomadd4") + DisableMadd4 = true; else if (Feature == "+fp64") HasFP64 = true; else if (Feature == "-fp64") diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp index c17828974e92..eb230aad4d35 100644 --- a/lib/CodeGen/TargetInfo.cpp +++ b/lib/CodeGen/TargetInfo.cpp @@ -5573,17 +5573,14 @@ void ARMABIInfo::setCCs() { // AAPCS apparently requires runtime support functions to be soft-float, but // that's almost certainly for historic reasons (Thumb1 not supporting VFP // most likely). It's more convenient for AAPCS16_VFP to be hard-float. - switch (getABIKind()) { - case APCS: - case AAPCS16_VFP: - if (abiCC != getLLVMDefaultCC()) + + // The Run-time ABI for the ARM Architecture section 4.1.2 requires + // AEABI-complying FP helper functions to use the base AAPCS. + // These AEABI functions are expanded in the ARM llvm backend, all the builtin + // support functions emitted by clang such as the _Complex helpers follow the + // abiCC. + if (abiCC != getLLVMDefaultCC()) BuiltinCC = abiCC; - break; - case AAPCS: - case AAPCS_VFP: - BuiltinCC = llvm::CallingConv::ARM_AAPCS; - break; - } } ABIArgInfo ARMABIInfo::classifyArgumentType(QualType Ty, @@ -6754,14 +6751,6 @@ MipsABIInfo::classifyArgumentType(QualType Ty, uint64_t &Offset) const { return getNaturalAlignIndirect(Ty, RAA == CGCXXABI::RAA_DirectInMemory); } - // Use indirect if the aggregate cannot fit into registers for - // passing arguments according to the ABI - unsigned Threshold = IsO32 ? 16 : 64; - - if(getContext().getTypeSizeInChars(Ty) > CharUnits::fromQuantity(Threshold)) - return ABIArgInfo::getIndirect(CharUnits::fromQuantity(Align), true, - getContext().getTypeAlign(Ty) / 8 > Align); - // If we have reached here, aggregates are passed directly by coercing to // another structure type. Padding is inserted if the offset of the // aggregate is unaligned. diff --git a/lib/Driver/ToolChain.cpp b/lib/Driver/ToolChain.cpp index 2be7f0f69004..9a858df8ab2d 100644 --- a/lib/Driver/ToolChain.cpp +++ b/lib/Driver/ToolChain.cpp @@ -217,7 +217,7 @@ StringRef ToolChain::getDefaultUniversalArchName() const { } } -bool ToolChain::IsUnwindTablesDefault() const { +bool ToolChain::IsUnwindTablesDefault(const ArgList &Args) const { return false; } diff --git a/lib/Driver/ToolChains/Arch/Mips.cpp b/lib/Driver/ToolChains/Arch/Mips.cpp index 1da90d1dc7ba..b45dcd6db678 100644 --- a/lib/Driver/ToolChains/Arch/Mips.cpp +++ b/lib/Driver/ToolChains/Arch/Mips.cpp @@ -297,6 +297,8 @@ void mips::getMIPSTargetFeatures(const Driver &D, const llvm::Triple &Triple, AddTargetFeature(Args, Features, options::OPT_mno_odd_spreg, options::OPT_modd_spreg, "nooddspreg"); + AddTargetFeature(Args, Features, options::OPT_mno_madd4, options::OPT_mmadd4, + "nomadd4"); AddTargetFeature(Args, Features, options::OPT_mlong_calls, options::OPT_mno_long_calls, "long-calls"); AddTargetFeature(Args, Features, options::OPT_mmt, options::OPT_mno_mt,"mt"); diff --git a/lib/Driver/ToolChains/Clang.cpp b/lib/Driver/ToolChains/Clang.cpp index b82cc2d4fa5d..baf7a93d2d92 100644 --- a/lib/Driver/ToolChains/Clang.cpp +++ b/lib/Driver/ToolChains/Clang.cpp @@ -2538,7 +2538,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, bool AsynchronousUnwindTables = Args.hasFlag(options::OPT_fasynchronous_unwind_tables, options::OPT_fno_asynchronous_unwind_tables, - (getToolChain().IsUnwindTablesDefault() || + (getToolChain().IsUnwindTablesDefault(Args) || getToolChain().getSanitizerArgs().needsUnwindTables()) && !KernelOrKext); if (Args.hasFlag(options::OPT_funwind_tables, options::OPT_fno_unwind_tables, diff --git a/lib/Driver/ToolChains/CrossWindows.cpp b/lib/Driver/ToolChains/CrossWindows.cpp index 7d0c438b1360..04b71c48cd4c 100644 --- a/lib/Driver/ToolChains/CrossWindows.cpp +++ b/lib/Driver/ToolChains/CrossWindows.cpp @@ -214,7 +214,7 @@ CrossWindowsToolChain::CrossWindowsToolChain(const Driver &D, } } -bool CrossWindowsToolChain::IsUnwindTablesDefault() const { +bool CrossWindowsToolChain::IsUnwindTablesDefault(const ArgList &Args) const { // FIXME: all non-x86 targets need unwind tables, however, LLVM currently does // not know how to emit them. return getArch() == llvm::Triple::x86_64; diff --git a/lib/Driver/ToolChains/CrossWindows.h b/lib/Driver/ToolChains/CrossWindows.h index 5375a6324a3f..2f66446ec732 100644 --- a/lib/Driver/ToolChains/CrossWindows.h +++ b/lib/Driver/ToolChains/CrossWindows.h @@ -56,7 +56,7 @@ class LLVM_LIBRARY_VISIBILITY CrossWindowsToolChain : public Generic_GCC { const llvm::opt::ArgList &Args); bool IsIntegratedAssemblerDefault() const override { return true; } - bool IsUnwindTablesDefault() const override; + bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override; bool isPICDefault() const override; bool isPIEDefault() const override; bool isPICDefaultForced() const override; diff --git a/lib/Driver/ToolChains/Darwin.cpp b/lib/Driver/ToolChains/Darwin.cpp index 0d63858f2cd4..6b7f0c71dfb7 100644 --- a/lib/Driver/ToolChains/Darwin.cpp +++ b/lib/Driver/ToolChains/Darwin.cpp @@ -1174,13 +1174,12 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) const { unsigned Major, Minor, Micro; bool HadExtra; - // iOS 10 is the maximum deployment target for 32-bit targets. - if (iOSVersion && getTriple().isArch32Bit() && - Driver::GetReleaseVersion(iOSVersion->getValue(), Major, Minor, Micro, - HadExtra) && - Major > 10) - getDriver().Diag(diag::err_invalid_ios_deployment_target) - << iOSVersion->getAsString(Args); + // The iOS deployment target that is explicitly specified via a command line + // option or an environment variable. + std::string ExplicitIOSDeploymentTargetStr; + + if (iOSVersion) + ExplicitIOSDeploymentTargetStr = iOSVersion->getAsString(Args); // Add a macro to differentiate between m(iphone|tv|watch)os-version-min=X.Y and // -m(iphone|tv|watch)simulator-version-min=X.Y. @@ -1223,13 +1222,9 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) const { if (char *env = ::getenv("WATCHOS_DEPLOYMENT_TARGET")) WatchOSTarget = env; - // iOS 10 is the maximum deployment target for 32-bit targets. - if (!iOSTarget.empty() && getTriple().isArch32Bit() && - Driver::GetReleaseVersion(iOSTarget.c_str(), Major, Minor, Micro, - HadExtra) && - Major > 10) - getDriver().Diag(diag::err_invalid_ios_deployment_target) - << std::string("IPHONEOS_DEPLOYMENT_TARGET=") + iOSTarget; + if (!iOSTarget.empty()) + ExplicitIOSDeploymentTargetStr = + std::string("IPHONEOS_DEPLOYMENT_TARGET=") + iOSTarget; // If there is no command-line argument to specify the Target version and // no environment variable defined, see if we can set the default based @@ -1393,12 +1388,19 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) const { HadExtra || Major >= 100 || Minor >= 100 || Micro >= 100) getDriver().Diag(diag::err_drv_invalid_version_number) << iOSVersion->getAsString(Args); - // iOS 10 is the maximum deployment target for 32-bit targets. If the - // inferred deployment target is iOS 11 or later, set it to 10.99. + // For 32-bit targets, the deployment target for iOS has to be earlier than + // iOS 11. if (getTriple().isArch32Bit() && Major >= 11) { - Major = 10; - Minor = 99; - Micro = 99; + // If the deployment target is explicitly specified, print a diagnostic. + if (!ExplicitIOSDeploymentTargetStr.empty()) { + getDriver().Diag(diag::warn_invalid_ios_deployment_target) + << ExplicitIOSDeploymentTargetStr; + // Otherwise, set it to 10.99.99. + } else { + Major = 10; + Minor = 99; + Micro = 99; + } } } else if (Platform == TvOS) { if (!Driver::GetReleaseVersion(TvOSVersion->getValue(), Major, Minor, @@ -1834,8 +1836,8 @@ Darwin::TranslateArgs(const DerivedArgList &Args, StringRef BoundArch, return DAL; } -bool MachO::IsUnwindTablesDefault() const { - return getArch() == llvm::Triple::x86_64; +bool MachO::IsUnwindTablesDefault(const ArgList &Args) const { + return !UseSjLjExceptions(Args); } bool MachO::UseDwarfDebugFlags() const { diff --git a/lib/Driver/ToolChains/Darwin.h b/lib/Driver/ToolChains/Darwin.h index 6cb1d04b78c0..77c569e8f865 100644 --- a/lib/Driver/ToolChains/Darwin.h +++ b/lib/Driver/ToolChains/Darwin.h @@ -216,7 +216,7 @@ class LLVM_LIBRARY_VISIBILITY MachO : public ToolChain { bool UseObjCMixedDispatch() const override { return true; } - bool IsUnwindTablesDefault() const override; + bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override; RuntimeLibType GetDefaultRuntimeLibType() const override { return ToolChain::RLT_CompilerRT; diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp index bc26ee1de46d..72a9f85ba389 100644 --- a/lib/Driver/ToolChains/Gnu.cpp +++ b/lib/Driver/ToolChains/Gnu.cpp @@ -2291,7 +2291,7 @@ void Generic_GCC::printVerboseInfo(raw_ostream &OS) const { CudaInstallation.print(OS); } -bool Generic_GCC::IsUnwindTablesDefault() const { +bool Generic_GCC::IsUnwindTablesDefault(const ArgList &Args) const { return getArch() == llvm::Triple::x86_64; } diff --git a/lib/Driver/ToolChains/Gnu.h b/lib/Driver/ToolChains/Gnu.h index cdf610054401..f29342b95a07 100644 --- a/lib/Driver/ToolChains/Gnu.h +++ b/lib/Driver/ToolChains/Gnu.h @@ -284,7 +284,7 @@ class LLVM_LIBRARY_VISIBILITY Generic_GCC : public ToolChain { void printVerboseInfo(raw_ostream &OS) const override; - bool IsUnwindTablesDefault() const override; + bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override; bool isPICDefault() const override; bool isPIEDefault() const override; bool isPICDefaultForced() const override; diff --git a/lib/Driver/ToolChains/MSVC.cpp b/lib/Driver/ToolChains/MSVC.cpp index 9e9d943610be..b871c856d2a0 100644 --- a/lib/Driver/ToolChains/MSVC.cpp +++ b/lib/Driver/ToolChains/MSVC.cpp @@ -699,7 +699,7 @@ bool MSVCToolChain::IsIntegratedAssemblerDefault() const { return true; } -bool MSVCToolChain::IsUnwindTablesDefault() const { +bool MSVCToolChain::IsUnwindTablesDefault(const ArgList &Args) const { // Emit unwind tables by default on Win64. All non-x86_32 Windows platforms // such as ARM and PPC actually require unwind tables, but LLVM doesn't know // how to generate them yet. diff --git a/lib/Driver/ToolChains/MSVC.h b/lib/Driver/ToolChains/MSVC.h index 055830c52e0d..d153691a5c90 100644 --- a/lib/Driver/ToolChains/MSVC.h +++ b/lib/Driver/ToolChains/MSVC.h @@ -73,7 +73,7 @@ class LLVM_LIBRARY_VISIBILITY MSVCToolChain : public ToolChain { Action::OffloadKind DeviceOffloadKind) const override; bool IsIntegratedAssemblerDefault() const override; - bool IsUnwindTablesDefault() const override; + bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override; bool isPICDefault() const override; bool isPIEDefault() const override; bool isPICDefaultForced() const override; diff --git a/lib/Driver/ToolChains/MinGW.cpp b/lib/Driver/ToolChains/MinGW.cpp index 7550bab486f1..632b76d92bdd 100644 --- a/lib/Driver/ToolChains/MinGW.cpp +++ b/lib/Driver/ToolChains/MinGW.cpp @@ -347,7 +347,7 @@ Tool *toolchains::MinGW::buildLinker() const { return new tools::MinGW::Linker(*this); } -bool toolchains::MinGW::IsUnwindTablesDefault() const { +bool toolchains::MinGW::IsUnwindTablesDefault(const ArgList &Args) const { return getArch() == llvm::Triple::x86_64; } diff --git a/lib/Driver/ToolChains/MinGW.h b/lib/Driver/ToolChains/MinGW.h index cf1628a4ccdd..9b3d7c553f1d 100644 --- a/lib/Driver/ToolChains/MinGW.h +++ b/lib/Driver/ToolChains/MinGW.h @@ -60,7 +60,7 @@ class LLVM_LIBRARY_VISIBILITY MinGW : public ToolChain { const llvm::opt::ArgList &Args); bool IsIntegratedAssemblerDefault() const override; - bool IsUnwindTablesDefault() const override; + bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override; bool isPICDefault() const override; bool isPIEDefault() const override; bool isPICDefaultForced() const override; diff --git a/lib/Driver/ToolChains/NetBSD.h b/lib/Driver/ToolChains/NetBSD.h index 412d0815e81a..5163ff72d81b 100644 --- a/lib/Driver/ToolChains/NetBSD.h +++ b/lib/Driver/ToolChains/NetBSD.h @@ -65,7 +65,10 @@ class LLVM_LIBRARY_VISIBILITY NetBSD : public Generic_ELF { const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override; - bool IsUnwindTablesDefault() const override { return true; } + bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override { + return true; + } + SanitizerMask getSupportedSanitizers() const override; protected: diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp index 64128dfdf534..92d61369b40f 100644 --- a/lib/Frontend/InitPreprocessor.cpp +++ b/lib/Frontend/InitPreprocessor.cpp @@ -497,6 +497,8 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts, Builder.defineMacro("__cpp_ref_qualifiers", "200710"); Builder.defineMacro("__cpp_alias_templates", "200704"); } + if (LangOpts.ThreadsafeStatics) + Builder.defineMacro("__cpp_threadsafe_static_init", "200806"); // C++14 features. if (LangOpts.CPlusPlus14) { @@ -519,6 +521,7 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts, Builder.defineMacro("__cpp_noexcept_function_type", "201510"); Builder.defineMacro("__cpp_capture_star_this", "201603"); Builder.defineMacro("__cpp_if_constexpr", "201606"); + Builder.defineMacro("__cpp_deduction_guides", "201611"); Builder.defineMacro("__cpp_template_auto", "201606"); Builder.defineMacro("__cpp_namespace_attributes", "201411"); Builder.defineMacro("__cpp_enumerator_attributes", "201411"); @@ -528,8 +531,6 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts, Builder.defineMacro("__cpp_structured_bindings", "201606"); Builder.defineMacro("__cpp_nontype_template_args", "201411"); Builder.defineMacro("__cpp_fold_expressions", "201603"); - // FIXME: This is not yet listed in SD-6. - Builder.defineMacro("__cpp_deduction_guides", "201611"); } if (LangOpts.AlignedAllocation) Builder.defineMacro("__cpp_aligned_new", "201606"); diff --git a/lib/Parse/ParseCXXInlineMethods.cpp b/lib/Parse/ParseCXXInlineMethods.cpp index b68559485a5e..27651c9ca85c 100644 --- a/lib/Parse/ParseCXXInlineMethods.cpp +++ b/lib/Parse/ParseCXXInlineMethods.cpp @@ -166,20 +166,11 @@ NamedDecl *Parser::ParseCXXInlineMethodDef(AccessSpecifier AS, } if (FnD) { - // If this is a friend function, mark that it's late-parsed so that - // it's still known to be a definition even before we attach the - // parsed body. Sema needs to treat friend function definitions - // differently during template instantiation, and it's possible for - // the containing class to be instantiated before all its member - // function definitions are parsed. - // - // If you remove this, you can remove the code that clears the flag - // after parsing the member. - if (D.getDeclSpec().isFriendSpecified()) { - FunctionDecl *FD = FnD->getAsFunction(); - Actions.CheckForFunctionRedefinition(FD); - FD->setLateTemplateParsed(true); - } + FunctionDecl *FD = FnD->getAsFunction(); + // Track that this function will eventually have a body; Sema needs + // to know this. + Actions.CheckForFunctionRedefinition(FD); + FD->setWillHaveBody(true); } else { // If semantic analysis could not build a function declaration, // just throw away the late-parsed declaration. @@ -558,10 +549,6 @@ void Parser::ParseLexedMethodDef(LexedMethod &LM) { ParseFunctionStatementBody(LM.D, FnScope); - // Clear the late-template-parsed bit if we set it before. - if (LM.D) - LM.D->getAsFunction()->setLateTemplateParsed(false); - while (Tok.isNot(tok::eof)) ConsumeAnyToken(); diff --git a/lib/Sema/SemaCast.cpp b/lib/Sema/SemaCast.cpp index ba2049d8a606..d603101c3fd9 100644 --- a/lib/Sema/SemaCast.cpp +++ b/lib/Sema/SemaCast.cpp @@ -552,7 +552,14 @@ CastsAwayConstness(Sema &Self, QualType SrcType, QualType DestType, Qualifiers SrcQuals, DestQuals; Self.Context.getUnqualifiedArrayType(UnwrappedSrcType, SrcQuals); Self.Context.getUnqualifiedArrayType(UnwrappedDestType, DestQuals); - + + // We do not meaningfully track object const-ness of Objective-C object + // types. Remove const from the source type if either the source or + // the destination is an Objective-C object type. + if (UnwrappedSrcType->isObjCObjectType() || + UnwrappedDestType->isObjCObjectType()) + SrcQuals.removeConst(); + Qualifiers RetainedSrcQuals, RetainedDestQuals; if (CheckCVR) { RetainedSrcQuals.setCVRQualifiers(SrcQuals.getCVRQualifiers()); diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp index 91a8c619b26c..4de7d422072d 100644 --- a/lib/Sema/SemaCodeComplete.cpp +++ b/lib/Sema/SemaCodeComplete.cpp @@ -2401,10 +2401,7 @@ formatBlockPlaceholder(const PrintingPolicy &Policy, const NamedDecl *BlockDecl, static std::string GetDefaultValueString(const ParmVarDecl *Param, const SourceManager &SM, const LangOptions &LangOpts) { - const Expr *defaultArg = Param->getDefaultArg(); - if (!defaultArg) - return ""; - const SourceRange SrcRange = defaultArg->getSourceRange(); + const SourceRange SrcRange = Param->getDefaultArgRange(); CharSourceRange CharSrcRange = CharSourceRange::getTokenRange(SrcRange); bool Invalid = CharSrcRange.isInvalid(); if (Invalid) diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 31b24f91c1d9..692a77e2b62f 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -6999,6 +6999,21 @@ void Sema::CheckShadow(NamedDecl *D, NamedDecl *ShadowedDecl, return; } } + + if (cast(ShadowedDecl)->hasLocalStorage()) { + // A variable can't shadow a local variable in an enclosing scope, if + // they are separated by a non-capturing declaration context. + for (DeclContext *ParentDC = NewDC; + ParentDC && !ParentDC->Equals(OldDC); + ParentDC = getLambdaAwareParentOfDeclContext(ParentDC)) { + // Only block literals, captured statements, and lambda expressions + // can capture; other scopes don't. + if (!isa(ParentDC) && !isa(ParentDC) && + !isLambdaCallOperator(ParentDC)) { + return; + } + } + } } } @@ -12075,8 +12090,9 @@ Decl *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Decl *D, FD->setInvalidDecl(); } - // See if this is a redefinition. - if (!FD->isLateTemplateParsed()) { + // See if this is a redefinition. If 'will have body' is already set, then + // these checks were already performed when it was set. + if (!FD->willHaveBody() && !FD->isLateTemplateParsed()) { CheckForFunctionRedefinition(FD, nullptr, SkipBody); // If we're skipping the body, we're done. Don't enter the scope. @@ -13278,6 +13294,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, AddMsStructLayoutForRecord(RD); } } + New->setLexicalDeclContext(CurContext); return New; }; diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index abe912fb548b..6fee23aa8bc1 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -3771,6 +3771,8 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, if (PatternDef) { Pattern = PatternDef->getBody(PatternDef); PatternDecl = PatternDef; + if (PatternDef->willHaveBody()) + PatternDef = nullptr; } // FIXME: We need to track the instantiation stack in order to know which diff --git a/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p2.cpp b/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p2.cpp index 3d4b92518810..072f5e74aabb 100644 --- a/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p2.cpp +++ b/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p2.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fsyntax-only -std=c++1z -verify -Wc++1z-extensions %s -// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify -DEXT -Wc++1z-extensions %s +// RUN: %clang_cc1 -fsyntax-only -std=c++17 -verify -Wc++17-extensions %s +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify -DEXT -Wc++17-extensions %s struct [[nodiscard]] S {}; S get_s(); @@ -23,7 +23,7 @@ void f() { } #ifdef EXT -// expected-warning@4 {{use of the 'nodiscard' attribute is a C++1z extension}} -// expected-warning@8 {{use of the 'nodiscard' attribute is a C++1z extension}} -// expected-warning@11 {{use of the 'nodiscard' attribute is a C++1z extension}} +// expected-warning@4 {{use of the 'nodiscard' attribute is a C++17 extension}} +// expected-warning@8 {{use of the 'nodiscard' attribute is a C++17 extension}} +// expected-warning@11 {{use of the 'nodiscard' attribute is a C++17 extension}} #endif diff --git a/test/CXX/dcl.dcl/dcl.attr/dcl.attr.unused/p3.cpp b/test/CXX/dcl.dcl/dcl.attr/dcl.attr.unused/p3.cpp index a627d8331a74..551df38a8100 100644 --- a/test/CXX/dcl.dcl/dcl.attr/dcl.attr.unused/p3.cpp +++ b/test/CXX/dcl.dcl/dcl.attr/dcl.attr.unused/p3.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fsyntax-only -Wunused -Wused-but-marked-unused -std=c++1z -Wc++1z-extensions -verify %s -// RUN: %clang_cc1 -fsyntax-only -Wunused -Wused-but-marked-unused -std=c++11 -Wc++1z-extensions -verify -DEXT %s +// RUN: %clang_cc1 -fsyntax-only -Wunused -Wused-but-marked-unused -std=c++17 -Wc++17-extensions -verify %s +// RUN: %clang_cc1 -fsyntax-only -Wunused -Wused-but-marked-unused -std=c++11 -Wc++17-extensions -verify -DEXT %s static_assert(__has_cpp_attribute(maybe_unused) == 201603, ""); @@ -20,7 +20,7 @@ void f() { } #ifdef EXT -// expected-warning@6 {{use of the 'maybe_unused' attribute is a C++1z extension}} -// expected-warning@13 {{use of the 'maybe_unused' attribute is a C++1z extension}} -// expected-warning@14 {{use of the 'maybe_unused' attribute is a C++1z extension}} +// expected-warning@6 {{use of the 'maybe_unused' attribute is a C++17 extension}} +// expected-warning@13 {{use of the 'maybe_unused' attribute is a C++17 extension}} +// expected-warning@14 {{use of the 'maybe_unused' attribute is a C++17 extension}} #endif diff --git a/test/CXX/drs/dr0xx.cpp b/test/CXX/drs/dr0xx.cpp index 055f40f98f66..fbca6635ec18 100644 --- a/test/CXX/drs/dr0xx.cpp +++ b/test/CXX/drs/dr0xx.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -Wno-bind-to-temporary-copy // RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple // RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple -// RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple +// RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple namespace dr1 { // dr1: no namespace X { extern "C" void dr1_f(int a = 1); } @@ -276,9 +276,9 @@ namespace dr23 { // dr23: yes namespace dr25 { // dr25: yes struct A { - void f() throw(int); // expected-error 0-1{{ISO C++1z does not allow}} expected-note 0-1{{use 'noexcept}} + void f() throw(int); // expected-error 0-1{{ISO C++17 does not allow}} expected-note 0-1{{use 'noexcept}} }; - void (A::*f)() throw (int); // expected-error 0-1{{ISO C++1z does not allow}} expected-note 0-1{{use 'noexcept}} + void (A::*f)() throw (int); // expected-error 0-1{{ISO C++17 does not allow}} expected-note 0-1{{use 'noexcept}} void (A::*g)() throw () = f; #if __cplusplus <= 201402L // expected-error@-2 {{is not superset of source}} @@ -286,7 +286,7 @@ namespace dr25 { // dr25: yes // expected-error@-4 {{different exception specifications}} #endif void (A::*g2)() throw () = 0; - void (A::*h)() throw (int, char) = f; // expected-error 0-1{{ISO C++1z does not allow}} expected-note 0-1{{use 'noexcept}} + void (A::*h)() throw (int, char) = f; // expected-error 0-1{{ISO C++17 does not allow}} expected-note 0-1{{use 'noexcept}} void (A::*i)() throw () = &A::f; #if __cplusplus <= 201402L // expected-error@-2 {{is not superset of source}} @@ -294,7 +294,7 @@ namespace dr25 { // dr25: yes // expected-error@-4 {{different exception specifications}} #endif void (A::*i2)() throw () = 0; - void (A::*j)() throw (int, char) = &A::f; // expected-error 0-1{{ISO C++1z does not allow}} expected-note 0-1{{use 'noexcept}} + void (A::*j)() throw (int, char) = &A::f; // expected-error 0-1{{ISO C++17 does not allow}} expected-note 0-1{{use 'noexcept}} void x() { g2 = f; #if __cplusplus <= 201402L @@ -941,7 +941,7 @@ namespace dr84 { // dr84: yes }; A a; // Cannot use B(C) / operator C() pair to construct the B from the B temporary - // here. In C++1z, we initialize the B object directly using 'A::operator B()'. + // here. In C++17, we initialize the B object directly using 'A::operator B()'. B b = a; #if __cplusplus <= 201402L // expected-error@-2 {{no viable}} @@ -1033,14 +1033,14 @@ namespace dr91 { // dr91: yes } namespace dr92 { // dr92: 4 c++17 - void f() throw(int, float); // expected-error 0-1{{ISO C++1z does not allow}} expected-note 0-1{{use 'noexcept}} - void (*p)() throw(int) = &f; // expected-error 0-1{{ISO C++1z does not allow}} expected-note 0-1{{use 'noexcept}} + void f() throw(int, float); // expected-error 0-1{{ISO C++17 does not allow}} expected-note 0-1{{use 'noexcept}} + void (*p)() throw(int) = &f; // expected-error 0-1{{ISO C++17 does not allow}} expected-note 0-1{{use 'noexcept}} #if __cplusplus <= 201402L // expected-error@-2 {{target exception specification is not superset of source}} #else // expected-warning@-4 {{target exception specification is not superset of source}} #endif - void (*q)() throw(int); // expected-error 0-1{{ISO C++1z does not allow}} expected-note 0-1{{use 'noexcept}} + void (*q)() throw(int); // expected-error 0-1{{ISO C++17 does not allow}} expected-note 0-1{{use 'noexcept}} void (**pp)() throw() = &q; #if __cplusplus <= 201402L // expected-error@-2 {{exception specifications are not allowed}} @@ -1064,7 +1064,7 @@ namespace dr92 { // dr92: 4 c++17 // expected-error@-2 {{not implicitly convertible}} #endif - template struct Y {}; // expected-error 0-1{{ISO C++1z does not allow}} expected-note 0-1{{use 'noexcept}} + template struct Y {}; // expected-error 0-1{{ISO C++17 does not allow}} expected-note 0-1{{use 'noexcept}} Y<&h> yp; // ok } diff --git a/test/CXX/drs/dr13xx.cpp b/test/CXX/drs/dr13xx.cpp index 64ba3be2a618..f193c8e024fb 100644 --- a/test/CXX/drs/dr13xx.cpp +++ b/test/CXX/drs/dr13xx.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors __extension__ typedef __SIZE_TYPE__ size_t; @@ -124,7 +124,7 @@ namespace dr1315 { // dr1315: partial namespace dr1330 { // dr1330: 4 c++11 // exception-specifications are parsed in a context where the class is complete. struct A { - void f() throw(T) {} // expected-error 0-1{{C++1z}} expected-note 0-1{{noexcept}} + void f() throw(T) {} // expected-error 0-1{{C++17}} expected-note 0-1{{noexcept}} struct T {}; #if __cplusplus >= 201103L @@ -134,7 +134,7 @@ namespace dr1330 { // dr1330: 4 c++11 #endif }; - void (A::*af1)() throw(A::T) = &A::f; // expected-error 0-1{{C++1z}} expected-note 0-1{{noexcept}} + void (A::*af1)() throw(A::T) = &A::f; // expected-error 0-1{{C++17}} expected-note 0-1{{noexcept}} void (A::*af2)() throw() = &A::f; // expected-error-re {{{{not superset|different exception spec}}}} #if __cplusplus >= 201103L @@ -144,7 +144,7 @@ namespace dr1330 { // dr1330: 4 c++11 // Likewise, they're instantiated separately from an enclosing class template. template struct B { - void f() throw(T, typename U::type) {} // expected-error 0-1{{C++1z}} expected-note 0-1{{noexcept}} + void f() throw(T, typename U::type) {} // expected-error 0-1{{C++17}} expected-note 0-1{{noexcept}} struct T {}; #if __cplusplus >= 201103L @@ -161,7 +161,7 @@ namespace dr1330 { // dr1330: 4 c++11 static const int value = true; }; - void (B

::*bpf1)() throw(B

::T, int) = &B

::f; // expected-error 0-1{{C++1z}} expected-note 0-1{{noexcept}} + void (B

::*bpf1)() throw(B

::T, int) = &B

::f; // expected-error 0-1{{C++17}} expected-note 0-1{{noexcept}} #if __cplusplus < 201103L // expected-error@-2 {{not superset}} // FIXME: We only delay instantiation in C++11 onwards. In C++98, something @@ -172,7 +172,7 @@ namespace dr1330 { // dr1330: 4 c++11 // the "T has not yet been instantiated" error here, rather than giving // confusing errors later on. #endif - void (B

::*bpf2)() throw(int) = &B

::f; // expected-error 0-1{{C++1z}} expected-note 0-1{{noexcept}} + void (B

::*bpf2)() throw(int) = &B

::f; // expected-error 0-1{{C++17}} expected-note 0-1{{noexcept}} #if __cplusplus <= 201402L // expected-error@-2 {{not superset}} #else @@ -194,7 +194,7 @@ namespace dr1330 { // dr1330: 4 c++11 template int f() throw(typename T::error) { return 0; } // expected-error 1-4{{prior to '::'}} expected-note 0-1{{prior to '::'}} expected-note 0-1{{requested here}} #if __cplusplus > 201402L - // expected-error@-2 0-1{{C++1z}} expected-note@-2 0-1{{noexcept}} + // expected-error@-2 0-1{{C++17}} expected-note@-2 0-1{{noexcept}} #endif // An exception-specification is needed even if the function is only used in // an unevaluated operand. @@ -203,7 +203,7 @@ namespace dr1330 { // dr1330: 4 c++11 decltype(f()) f2; // expected-note {{instantiation of}} bool f3 = noexcept(f()); // expected-note {{instantiation of}} #endif - // In C++1z onwards, substituting explicit template arguments into the + // In C++17 onwards, substituting explicit template arguments into the // function type substitutes into the exception specification (because it's // part of the type). In earlier languages, we don't notice there's a problem // until we've already started to instantiate. @@ -217,7 +217,7 @@ namespace dr1330 { // dr1330: 4 c++11 template struct C { C() throw(typename T::type); // expected-error 1-2{{prior to '::'}} #if __cplusplus > 201402L - // expected-error@-2 0-1{{C++1z}} expected-note@-2 0-1{{noexcept}} + // expected-error@-2 0-1{{C++17}} expected-note@-2 0-1{{noexcept}} #endif }; struct D : C {}; // ok diff --git a/test/CXX/drs/dr1xx.cpp b/test/CXX/drs/dr1xx.cpp index f5395cfe183d..d62ed9f0d36d 100644 --- a/test/CXX/drs/dr1xx.cpp +++ b/test/CXX/drs/dr1xx.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++1z -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors namespace dr100 { // dr100: yes template struct A {}; // expected-note 0-1{{declared here}} @@ -313,7 +313,7 @@ namespace dr126 { // dr126: no virtual void z() throw(long); // expected-error {{more lax}} }; #else - void f() throw(int); // expected-error {{ISO C++1z does not allow}} expected-note {{use 'noexcept}} + void f() throw(int); // expected-error {{ISO C++17 does not allow}} expected-note {{use 'noexcept}} #endif } diff --git a/test/CXX/drs/dr20xx.cpp b/test/CXX/drs/dr20xx.cpp index b97a9a46bc85..5819c319fd54 100644 --- a/test/CXX/drs/dr20xx.cpp +++ b/test/CXX/drs/dr20xx.cpp @@ -10,7 +10,7 @@ #define static_assert(...) _Static_assert(__VA_ARGS__) #endif -namespace dr2094 { // dr2094: 5.0 +namespace dr2094 { // dr2094: 5 struct A { int n; }; struct B { volatile int n; }; static_assert(__is_trivially_copyable(volatile int), ""); diff --git a/test/CXX/drs/dr2xx.cpp b/test/CXX/drs/dr2xx.cpp index a5677a125a00..4e745ef2f4d0 100644 --- a/test/CXX/drs/dr2xx.cpp +++ b/test/CXX/drs/dr2xx.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // PR13819 -- __SIZE_TYPE__ is incompatible. typedef __SIZE_TYPE__ size_t; // expected-error 0-1 {{extension}} @@ -984,7 +984,7 @@ namespace dr289 { // dr289: yes namespace dr294 { // dr294: no void f() throw(int); #if __cplusplus > 201402L - // expected-error@-2 {{ISO C++1z does not allow}} expected-note@-2 {{use 'noexcept}} + // expected-error@-2 {{ISO C++17 does not allow}} expected-note@-2 {{use 'noexcept}} #endif int main() { (void)static_cast(f); // FIXME: ill-formed in C++14 and before @@ -1001,13 +1001,13 @@ namespace dr294 { // dr294: no #endif (void)static_cast(f); // FIXME: ill-formed in C++14 and before #if __cplusplus > 201402L - // expected-error@-2 {{ISO C++1z does not allow}} expected-note@-2 {{use 'noexcept}} + // expected-error@-2 {{ISO C++17 does not allow}} expected-note@-2 {{use 'noexcept}} #endif void (*p)() throw() = f; // expected-error-re {{{{not superset|different exception specification}}}} void (*q)() throw(int) = f; #if __cplusplus > 201402L - // expected-error@-2 {{ISO C++1z does not allow}} expected-note@-2 {{use 'noexcept}} + // expected-error@-2 {{ISO C++17 does not allow}} expected-note@-2 {{use 'noexcept}} #endif } } diff --git a/test/CXX/drs/dr4xx.cpp b/test/CXX/drs/dr4xx.cpp index a55bb91be558..1a5976eadaff 100644 --- a/test/CXX/drs/dr4xx.cpp +++ b/test/CXX/drs/dr4xx.cpp @@ -1,7 +1,7 @@ // RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -// RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // FIXME: __SIZE_TYPE__ expands to 'long long' on some targets. __extension__ typedef __SIZE_TYPE__ size_t; @@ -507,16 +507,16 @@ namespace dr437 { // dr437: sup 1308 struct S { void f() throw(S); #if __cplusplus > 201402L - // expected-error@-2 {{ISO C++1z does not allow}} expected-note@-2 {{use 'noexcept}} + // expected-error@-2 {{ISO C++17 does not allow}} expected-note@-2 {{use 'noexcept}} #endif void g() throw(T); #if __cplusplus > 201402L - // expected-error@-2 {{ISO C++1z does not allow}} expected-note@-2 {{use 'noexcept}} + // expected-error@-2 {{ISO C++17 does not allow}} expected-note@-2 {{use 'noexcept}} #endif struct U; void h() throw(U); #if __cplusplus > 201402L - // expected-error@-2 {{ISO C++1z does not allow}} expected-note@-2 {{use 'noexcept}} + // expected-error@-2 {{ISO C++17 does not allow}} expected-note@-2 {{use 'noexcept}} #endif struct U {}; }; @@ -1202,7 +1202,7 @@ namespace dr495 { // dr495: 3.5 long n2 = s2; } -namespace dr496 { // dr496: sup dr2094 +namespace dr496 { // dr496: sup 2094 struct A { int n; }; struct B { volatile int n; }; int check1[ __is_trivially_copyable(const int) ? 1 : -1]; diff --git a/test/CXX/drs/dr5xx.cpp b/test/CXX/drs/dr5xx.cpp index 97b40b8b7c26..5122398b7ca3 100644 --- a/test/CXX/drs/dr5xx.cpp +++ b/test/CXX/drs/dr5xx.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // FIXME: This is included to avoid a diagnostic with no source location // pointing at the implicit operator new. We can't match such a diagnostic @@ -966,7 +966,7 @@ namespace dr595 { // dr595: dup 1330 template struct X { void f() throw(T) {} #if __cplusplus > 201402L - // expected-error@-2 {{ISO C++1z does not allow}} expected-note@-2 {{use 'noexcept}} + // expected-error@-2 {{ISO C++17 does not allow}} expected-note@-2 {{use 'noexcept}} #endif }; struct S { diff --git a/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp b/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp index 8c4f36c0ff74..ad6086835876 100644 --- a/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp +++ b/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify %s -// RUN: %clang_cc1 -std=c++1z -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify %s struct pr12960 { int begin; @@ -125,7 +125,7 @@ void g() { }; for (auto a : Differ()) #if __cplusplus <= 201402L - // expected-warning@-2 {{'begin' and 'end' returning different types ('int *' and 'null_t') is a C++1z extension}} + // expected-warning@-2 {{'begin' and 'end' returning different types ('int *' and 'null_t') is a C++17 extension}} // expected-note@-6 {{selected 'begin' function with iterator type 'int *'}} // expected-note@-6 {{selected 'end' function with iterator type 'null_t'}} #endif diff --git a/test/CodeCompletion/uninstantiated_params.cpp b/test/CodeCompletion/uninstantiated_params.cpp new file mode 100644 index 000000000000..57a520dd5712 --- /dev/null +++ b/test/CodeCompletion/uninstantiated_params.cpp @@ -0,0 +1,13 @@ +template +struct unique_ptr { + typedef T* pointer; + + void reset(pointer ptr = pointer()); +}; + +void test() { + unique_ptr x; + x. + // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:10:5 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s + // CHECK-CC1: [#void#]reset({#<#unique_ptr::pointer ptr = pointer()#>#}) +} diff --git a/test/CodeGen/arm-float-helpers.c b/test/CodeGen/arm-float-helpers.c new file mode 100644 index 000000000000..30363304bcf9 --- /dev/null +++ b/test/CodeGen/arm-float-helpers.c @@ -0,0 +1,233 @@ +// REQUIRES: arm-registered-target +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabi %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabihf %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabi -target-feature "+soft-float" -target-feature "+soft-float-abi" %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabi -target-feature "+soft-float" %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi -meabi gnu %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi -target-feature "+soft-float" -target-feature "+soft-float-abi" -meabi gnu %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi -target-feature "+soft-float" -meabi gnu %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabihf %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabihf -meabi gnu %s | FileCheck %s + +// The Runtime ABI for the ARM Architecture IHI0043 section 4.1.2 The +// floating-point helper functions to always use the base AAPCS (soft-float) +// calling convention. +// +// These helper functions such as __aeabi_fadd are not explicitly called by +// clang, instead they are generated by the ARMISelLowering when they are +// needed; clang relies on llvm to use the base AAPCS. +// +// In this test we check that clang is not directly calling the __aeabi_ +// functions. We rely on llvm to test that the base AAPCS is used for any +// __aeabi_ function from 4.1.2 that is used. +// +// When compiled to an object file with -mfloat-abi=soft each function F +// below should result in a call to __aeabi_F. If clang is changed to call any +// of these functions directly the test will need to be altered to check that +// arm_aapcscc is used. +// +// Note that it is only the functions in 4.1.2 that must use the base AAPCS, +// other runtime functions such as the _Complex helper routines are not covered. + +float fadd(float a, float b) { return a + b; } +// CHECK-LABEL: define float @fadd(float %a, float %b) +// CHECK-NOT: __aeabi_fadd +// CHECK: %add = fadd float {{.*}}, {{.*}} + +float fdiv(float a, float b) { return a / b; } +// CHECK-LABEL: define float @fdiv(float %a, float %b) +// CHECK-NOT: __aeabi_fdiv +// CHECK: %div = fdiv float {{.*}}, {{.*}} + +float fmul(float a, float b) { return a * b; } +// CHECK-LABEL: define float @fmul(float %a, float %b) +// CHECK-NOT: __aeabi_fmul +// CHECK: %mul = fmul float {{.*}}, {{.*}} + +float fsub(float a, float b) { return a - b; } +// CHECK-LABEL: define float @fsub(float %a, float %b) +// CHECK-NOT: __aeabi_fsub +// CHECK: %sub = fsub float {{.*}}, {{.*}} + +int fcmpeq(float a, float b) { return a == b; } +// CHECK-LABEL: define i32 @fcmpeq(float %a, float %b) +// CHECK-NOT: __aeabi_fcmpeq +// CHECK: %cmp = fcmp oeq float {{.*}}, {{.*}} + +int fcmplt(float a, float b) { return a < b; } +// CHECK-LABEL: define i32 @fcmplt(float %a, float %b) +// CHECK-NOT: __aeabi_fcmplt +// CHECK: %cmp = fcmp olt float {{.*}}, {{.*}} + +int fcmple(float a, float b) { return a <= b; } +// CHECK-LABEL: define i32 @fcmple(float %a, float %b) +// CHECK-NOT: __aeabi_fcmple +// CHECK: %cmp = fcmp ole float {{.*}}, {{.*}} + +int fcmpge(float a, float b) { return a >= b; } +// CHECK-LABEL: define i32 @fcmpge(float %a, float %b) +// CHECK-NOT: __aeabi_fcmpge +// CHECK: %cmp = fcmp oge float {{.*}}, {{.*}} + +int fcmpgt(float a, float b) { return a > b; } +// CHECK-LABEL: define i32 @fcmpgt(float %a, float %b) +// CHECK-NOT: __aeabi_fcmpgt +// CHECK: %cmp = fcmp ogt float {{.*}}, {{.*}} + +int fcmpun(float a, float b) { return __builtin_isunordered(a, b); } +// CHECK-LABEL: define i32 @fcmpun(float %a, float %b) +// CHECK-NOT: __aeabi_fcmpun +// CHECK: %cmp = fcmp uno double %conv, %conv1 + +double dadd(double a, double b) { return a + b; } +// CHECK-LABEL: define double @dadd(double %a, double %b) +// CHECK-NOT: __aeabi_dadd +// CHECK: %add = fadd double {{.*}}, {{.*}} + +double ddiv(double a, double b) { return a / b; } +// CHECK-LABEL: define double @ddiv(double %a, double %b) +// CHECK-NOT: __aeabi_ddiv +// CHECK: %div = fdiv double {{.*}}, {{.*}} + +double dmul(double a, double b) { return a * b; } +// CHECK-LABEL: define double @dmul(double %a, double %b) +// CHECK-NOT: __aeabi_dmul +// CHECK: %mul = fmul double {{.*}}, {{.*}} + +double dsub(double a, double b) { return a - b; } +// CHECK-LABEL: define double @dsub(double %a, double %b) +// CHECK-NOT: __aeabi_dsub +// CHECK: %sub = fsub double {{.*}}, {{.*}} + +int dcmpeq(double a, double b) { return a == b; } +// CHECK-LABEL: define i32 @dcmpeq(double %a, double %b) +// CHECK-NOT: __aeabi_dcmpeq +// CHECK: %cmp = fcmp oeq double {{.*}}, {{.*}} + +int dcmplt(double a, double b) { return a < b; } +// CHECK-LABEL: define i32 @dcmplt(double %a, double %b) +// CHECK-NOT: __aeabi_dcmplt +// CHECK: %cmp = fcmp olt double {{.*}}, {{.*}} + +int dcmple(double a, double b) { return a <= b; } +// CHECK-LABEL: define i32 @dcmple(double %a, double %b) +// CHECK-NOT: __aeabi_dcmple +// CHECK: %cmp = fcmp ole double {{.*}}, {{.*}} + +int dcmpge(double a, double b) { return a >= b; } +// CHECK-LABEL: define i32 @dcmpge(double %a, double %b) +// CHECK-NOT: __aeabi_dcmpge +// CHECK: %cmp = fcmp oge double {{.*}}, {{.*}} + +int dcmpgt(double a, double b) { return a > b; } +// CHECK-LABEL: define i32 @dcmpgt(double %a, double %b) +// CHECK-NOT: __aeabi_dcmpgt +// CHECK: %cmp = fcmp ogt double {{.*}}, {{.*}} + +int dcmpun(double a, double b) { return __builtin_isunordered(a, b); } +// CHECK-LABEL: define i32 @dcmpun(double %a, double %b) +// CHECK-NOT: __aeabi_dcmpun +// CHECK: %cmp = fcmp uno double {{.*}}, {{.*}} + +int d2iz(double a) { return (int)a; } +// CHECK-LABEL: define i32 @d2iz(double %a) +// CHECK-NOT: __aeabi_d2iz +// CHECK: %conv = fptosi double {{.*}} to i32 + +unsigned int d2uiz(double a) { return (unsigned int)a; } +// CHECK-LABEL: define i32 @d2uiz(double %a) +// CHECK-NOT: __aeabi_d2uiz +// CHECK: %conv = fptoui double {{.*}} to i32 + +long long d2lz(double a) { return (long long)a; } +// CHECK-LABEL: define i64 @d2lz(double %a) +// CHECK-NOT: __aeabi_d2lz +// CHECK: %conv = fptosi double {{.*}} to i64 + +unsigned long long d2ulz(double a) { return (unsigned long long)a; } +// CHECK-LABEL: define i64 @d2ulz(double %a) +// CHECK-NOT: __aeabi_d2ulz +// CHECK: %conv = fptoui double {{.*}} to i64 + +int f2iz(float a) { return (int)a; } +// CHECK-LABEL: define i32 @f2iz(float %a) +// CHECK-NOT: __aeabi_f2iz +// CHECK: %conv = fptosi float {{.*}} to i32 + +unsigned int f2uiz(float a) { return (unsigned int)a; } +// CHECK-LABEL: define i32 @f2uiz(float %a) +// CHECK-NOT: __aeabi_f2uiz +// CHECK: %conv = fptoui float {{.*}} to i32 + +long long f2lz(float a) { return (long long)a; } +// CHECK-LABEL: define i64 @f2lz(float %a) +// CHECK-NOT: __aeabi_f2lz +// CHECK: %conv = fptosi float {{.*}} to i64 + +unsigned long long f2ulz(float a) { return (unsigned long long)a; } +// CHECK-LABEL: define i64 @f2ulz(float %a) +// CHECK-NOT: __aeabi_f2ulz +// CHECK: %conv = fptoui float {{.*}} to i64 + +float d2f(double a) { return (float)a; } +// CHECK-LABEL: define float @d2f(double %a) +// CHECK-NOT: __aeabi_d2f +// CHECK: %conv = fptrunc double {{.*}} to float + +double f2d(float a) { return (double)a; } +// CHECK-LABEL: define double @f2d(float %a) +// CHECK-NOT: __aeabi_f2d +// CHECK: %conv = fpext float {{.*}} to double + +double i2d(int a) { return (double)a; } +// CHECK-LABEL: define double @i2d(i32 %a) +// CHECK-NOT: __aeabi_i2d +// CHECK: %conv = sitofp i32 {{.*}} to double + +double ui2d(unsigned int a) { return (double)a; } +// CHECK-LABEL: define double @ui2d(i32 %a) +// CHECK-NOT: __aeabi_ui2d +// CHECK: %conv = uitofp i32 {{.*}} to double + +double l2d(long long a) { return (double)a; } +// CHECK-LABEL: define double @l2d(i64 %a) +// CHECK-NOT: __aeabi_l2d +// CHECK: %conv = sitofp i64 {{.*}} to double + +double ul2d(unsigned long long a) { return (unsigned long long)a; } +// CHECK-LABEL: define double @ul2d(i64 %a) +// CHECK-NOT: __aeabi_ul2d +// CHECK: %conv = uitofp i64 {{.*}} to double + +float i2f(int a) { return (int)a; } +// CHECK-LABEL: define float @i2f(i32 %a) +// CHECK-NOT: __aeabi_i2f +// CHECK: %conv = sitofp i32 {{.*}} to float + +float ui2f(unsigned int a) { return (unsigned int)a; } +// CHECK-LABEL: define float @ui2f(i32 %a) +// CHECK-NOT: __aeabi_ui2f +// CHECK: %conv = uitofp i32 {{.*}} to float + +float l2f(long long a) { return (long long)a; } +// CHECK-LABEL: define float @l2f(i64 %a) +// CHECK-NOT: __aeabi_l2f +// CHECK: %conv = sitofp i64 {{.*}} to float + +float ul2f(unsigned long long a) { return (unsigned long long)a; } +// CHECK-LABEL: define float @ul2f(i64 %a) +// CHECK-NOT: __aeabi_ul2f +// CHECK: %conv = uitofp i64 {{.*}} to float + +// Functions in section 4.1.2 not used by llvm and don't easily map directly to +// C source code. +// cfcmpeq +// cfcmple +// cfrcmple +// cdcmpeq +// cdcmple +// cdrcmple +// frsub +// drsub diff --git a/test/CodeGen/complex-math.c b/test/CodeGen/complex-math.c index 96c7ad9cdbc9..8792ca14b9d8 100644 --- a/test/CodeGen/complex-math.c +++ b/test/CodeGen/complex-math.c @@ -2,7 +2,8 @@ // RUN: %clang_cc1 %s -O1 -emit-llvm -triple x86_64-pc-win64 -o - | FileCheck %s --check-prefix=X86 // RUN: %clang_cc1 %s -O1 -emit-llvm -triple i686-unknown-unknown -o - | FileCheck %s --check-prefix=X86 // RUN: %clang_cc1 %s -O1 -emit-llvm -triple powerpc-unknown-unknown -o - | FileCheck %s --check-prefix=PPC -// RUN: %clang_cc1 %s -O1 -emit-llvm -triple armv7-none-linux-gnueabihf -o - | FileCheck %s --check-prefix=ARM +// RUN %clang_cc1 %s -O1 -emit-llvm -triple armv7-none-linux-gnueabi -o - | FileCheck %s --check-prefix=ARM +// RUN: %clang_cc1 %s -O1 -emit-llvm -triple armv7-none-linux-gnueabihf -o - | FileCheck %s --check-prefix=ARMHF // RUN: %clang_cc1 %s -O1 -emit-llvm -triple thumbv7k-apple-watchos2.0 -o - -target-abi aapcs16 | FileCheck %s --check-prefix=ARM7K float _Complex add_float_rr(float a, float b) { @@ -476,8 +477,15 @@ _Bool ne_float_cc(float _Complex a, float _Complex b) { // Check that the libcall will obtain proper calling convention on ARM _Complex double foo(_Complex double a, _Complex double b) { + // These functions are not defined as floating point helper functions in + // Run-time ABI for the ARM architecture document so they must not always + // use the base AAPCS. + // ARM-LABEL: @foo( - // ARM: call arm_aapcscc { double, double } @__muldc3 + // ARM: call void { double, double } @__muldc3 + + // ARMHF-LABEL: @foo( + // ARMHF: call { double, double } @__muldc3 // ARM7K-LABEL: @foo( // ARM7K: call { double, double } @__muldc3 diff --git a/test/CodeGen/mips-aggregate-arg.c b/test/CodeGen/mips-aggregate-arg.c deleted file mode 100644 index ccf30df7c22a..000000000000 --- a/test/CodeGen/mips-aggregate-arg.c +++ /dev/null @@ -1,38 +0,0 @@ -// RUN: %clang_cc1 -triple mipsel-unknown-linux-gnu -S -emit-llvm -o - %s | FileCheck -check-prefix=O32 %s -// RUN: %clang_cc1 -triple mips64el-unknown-linux-gnu -S -emit-llvm -o - %s -target-abi n32 | FileCheck -check-prefix=N32-N64 %s -// RUN: %clang_cc1 -triple mips64el-unknown-linux-gnu -S -emit-llvm -o - %s -target-abi n64 | FileCheck -check-prefix=N32-N64 %s - -struct t1 { - char t1[10]; -}; - -struct t2 { - char t2[20]; -}; - -struct t3 { - char t3[65]; -}; - -extern struct t1 g1; -extern struct t2 g2; -extern struct t3 g3; -extern void f1(struct t1); -extern void f2(struct t2); -extern void f3(struct t3); - -void f() { - -// O32: call void @f1(i32 inreg %{{[0-9]+}}, i32 inreg %{{[0-9]+}}, i16 inreg %{{[0-9]+}}) -// O32: call void @f2(%struct.t2* byval align 4 %{{.*}}) -// O32: call void @f3(%struct.t3* byval align 4 %{{.*}}) - -// N32-N64: call void @f1(i64 inreg %{{[0-9]+}}, i16 inreg %{{[0-9]+}}) -// N32-N64: call void @f2(i64 inreg %{{[0-9]+}}, i64 inreg %{{[0-9]+}}, i32 inreg %{{[0-9]+}}) -// N32-N64: call void @f3(%struct.t3* byval align 8 %{{.*}}) - - f1(g1); - f2(g2); - f3(g3); -} - diff --git a/test/CodeGen/mips-madd4.c b/test/CodeGen/mips-madd4.c new file mode 100644 index 000000000000..bc7bb593f95d --- /dev/null +++ b/test/CodeGen/mips-madd4.c @@ -0,0 +1,87 @@ +// REQUIRES: mips-registered-target +// RUN: %clang --target=mips64-unknown-linux -S -mmadd4 %s -o -| FileCheck %s -check-prefix=MADD4 +// RUN: %clang --target=mips64-unknown-linux -S -mno-madd4 %s -o -| FileCheck %s -check-prefix=NOMADD4 +// RUN: %clang --target=mips64-unknown-linux -S -mmadd4 -fno-honor-nans %s -o -| FileCheck %s -check-prefix=MADD4-NONAN +// RUN: %clang --target=mips64-unknown-linux -S -mno-madd4 -fno-honor-nans %s -o -| FileCheck %s -check-prefix=NOMADD4-NONAN + +float madd_s (float f, float g, float h) +{ + return (f * g) + h; +} +// MADD4: madd.s +// NOMADD4: mul.s +// NOMADD4: add.s + +float msub_s (float f, float g, float h) +{ + return (f * g) - h; +} +// MADD4: msub.s +// NOMADD4: mul.s +// NOMADD4: sub.s + +double madd_d (double f, double g, double h) +{ + return (f * g) + h; +} +// MADD4: madd.d +// NOMADD4: mul.d +// NOMADD4: add.d + +double msub_d (double f, double g, double h) +{ + return (f * g) - h; +} +// MADD4: msub.d +// NOMADD4: mul.d +// NOMADD4: sub.d + + +float nmadd_s (float f, float g, float h) +{ + // FIXME: Zero has been explicitly placed to force generation of a positive + // zero in IR until pattern used to match this instruction is changed to + // comply with negative zero as well. + return 0-((f * g) + h); +} +// MADD4-NONAN: nmadd.s +// NOMADD4-NONAN: mul.s +// NOMADD4-NONAN: add.s +// NOMADD4-NONAN: sub.s + +float nmsub_s (float f, float g, float h) +{ + // FIXME: Zero has been explicitly placed to force generation of a positive + // zero in IR until pattern used to match this instruction is changed to + // comply with negative zero as well. + return 0-((f * g) - h); +} +// MADD4-NONAN: nmsub.s +// NOMADD4-NONAN: mul.s +// NOMADD4-NONAN: sub.s +// NOMADD4-NONAN: sub.s + +double nmadd_d (double f, double g, double h) +{ + // FIXME: Zero has been explicitly placed to force generation of a positive + // zero in IR until pattern used to match this instruction is changed to + // comply with negative zero as well. + return 0-((f * g) + h); +} +// MADD4-NONAN: nmadd.d +// NOMADD4-NONAN: mul.d +// NOMADD4-NONAN: add.d +// NOMADD4-NONAN: sub.d + +double nmsub_d (double f, double g, double h) +{ + // FIXME: Zero has been explicitly placed to force generation of a positive + // zero in IR until pattern used to match this instruction is changed to + // comply with negative zero as well. + return 0-((f * g) - h); +} +// MADD4-NONAN: nmsub.d +// NOMADD4-NONAN: mul.d +// NOMADD4-NONAN: sub.d +// NOMADD4-NONAN: sub.d + diff --git a/test/CodeGenCXX/pr34163.cpp b/test/CodeGenCXX/pr34163.cpp new file mode 100644 index 000000000000..a200a0f509bc --- /dev/null +++ b/test/CodeGenCXX/pr34163.cpp @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -emit-llvm -debug-info-kind=standalone -triple x86_64-linux-gnu -o - -x c++ %s | FileCheck %s + +void f(struct X *) {} + +// CHECK: @_ZTV1X = +struct X { + void a() { delete this; } + virtual ~X() {} + virtual void key_function(); +}; + +// CHECK: define {{.*}} @_ZN1X12key_functionEv( +void X::key_function() {} diff --git a/test/Driver/clang-translation.c b/test/Driver/clang-translation.c index 7c7b2f05f1dc..545951d5aa11 100644 --- a/test/Driver/clang-translation.c +++ b/test/Driver/clang-translation.c @@ -69,6 +69,14 @@ // ARMV7_HARDFLOAT-NOT: "-msoft-float" // ARMV7_HARDFLOAT: "-x" "c" +// RUN: %clang -target arm64-apple-ios10 -### -S %s -arch arm64 2>&1 | \ +// RUN: FileCheck -check-prefix=ARM64-APPLE %s +// ARM64-APPLE: -munwind-table + +// RUN: %clang -target armv7k-apple-watchos4.0 -### -S %s -arch armv7k 2>&1 | \ +// RUN: FileCheck -check-prefix=ARMV7K-APPLE %s +// ARMV7K-APPLE: -munwind-table + // RUN: %clang -target arm-linux -### -S %s -march=armv5e 2>&1 | \ // RUN: FileCheck -check-prefix=ARMV5E %s // ARMV5E: clang diff --git a/test/Driver/darwin-version.c b/test/Driver/darwin-version.c index 12c7ef6eb0b1..3ff49aca6c02 100644 --- a/test/Driver/darwin-version.c +++ b/test/Driver/darwin-version.c @@ -26,6 +26,8 @@ // RUN: %clang -target armv7-apple-ios11.1 -c -### %s 2>&1 | \ // RUN: FileCheck --check-prefix=CHECK-VERSION-IOS7 %s +// RUN: %clang -target armv7-apple-ios9 -Wno-missing-sysroot -isysroot SDKs/iPhoneOS11.0.sdk -c -### %s 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-IOS7 %s // CHECK-VERSION-IOS7: thumbv7-apple-ios10.99.99 // RUN: env IPHONEOS_DEPLOYMENT_TARGET=11.0 \ @@ -45,6 +47,10 @@ // RUN: FileCheck --check-prefix=CHECK-VERSION-IOS11 %s // CHECK-VERSION-IOS11: arm64-apple-ios11.1.0 +// RUN: %clang -target armv7-apple-ios9.0 -miphoneos-version-min=11.0 -c -Wno-invalid-ios-deployment-target -### %s 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-IOS12 %s +// CHECK-VERSION-IOS12: thumbv7-apple-ios11.0.0 + // RUN: %clang -target i686-apple-darwin8 -c %s -### 2>&1 | \ // RUN: FileCheck --check-prefix=CHECK-VERSION-OSX4 %s // RUN: %clang -target i686-apple-darwin9 -mmacosx-version-min=10.4 -c %s -### 2>&1 | \ diff --git a/test/Driver/unknown-std.cpp b/test/Driver/unknown-std.cpp index 195a671edadf..a7aae5112221 100644 --- a/test/Driver/unknown-std.cpp +++ b/test/Driver/unknown-std.cpp @@ -13,8 +13,8 @@ // CHECK-NEXT: note: use 'gnu++11' for 'ISO C++ 2011 with amendments and GNU extensions' standard // CHECK-NEXT: note: use 'c++14' for 'ISO C++ 2014 with amendments' standard // CHECK-NEXT: note: use 'gnu++14' for 'ISO C++ 2014 with amendments and GNU extensions' standard -// CHECK-NEXT: note: use 'c++1z' for 'Working draft for ISO C++ 2017' standard -// CHECK-NEXT: note: use 'gnu++1z' for 'Working draft for ISO C++ 2017 with GNU extensions' standard +// CHECK-NEXT: note: use 'c++17' for 'ISO C++ 2017 with amendments' standard +// CHECK-NEXT: note: use 'gnu++17' for 'ISO C++ 2017 with amendments and GNU extensions' standard // CHECK-NEXT: note: use 'c++2a' for 'Working draft for ISO C++ 2020' standard // CHECK-NEXT: note: use 'gnu++2a' for 'Working draft for ISO C++ 2020 with GNU extensions' standard // CUDA-NEXT: note: use 'cuda' for 'NVIDIA CUDA(tm)' standard diff --git a/test/FixIt/fixit.cpp b/test/FixIt/fixit.cpp index 0b7fc626ff8a..92c561a20acc 100644 --- a/test/FixIt/fixit.cpp +++ b/test/FixIt/fixit.cpp @@ -216,7 +216,7 @@ template typedef Mystery::type getMysteriousThing() { // \ } template Foo, // expected-error {{template template parameter requires 'class' after the parameter list}} - template typename Bar, // expected-warning {{template template parameter using 'typename' is a C++1z extension}} + template typename Bar, // expected-warning {{template template parameter using 'typename' is a C++17 extension}} template struct Baz> // expected-error {{template template parameter requires 'class' after the parameter list}} void func(); diff --git a/test/Lexer/cxx-features.cpp b/test/Lexer/cxx-features.cpp index 24f38e51d91e..04821bdb2277 100644 --- a/test/Lexer/cxx-features.cpp +++ b/test/Lexer/cxx-features.cpp @@ -4,7 +4,7 @@ // RUN: %clang_cc1 -std=c++14 -fcxx-exceptions -fsized-deallocation -verify %s // RUN: %clang_cc1 -std=c++1z -fcxx-exceptions -fsized-deallocation -verify %s // RUN: %clang_cc1 -std=c++1z -fcxx-exceptions -fsized-deallocation -fconcepts-ts -DCONCEPTS_TS=1 -verify %s -// RUN: %clang_cc1 -fno-rtti -verify %s -DNO_EXCEPTIONS -DNO_RTTI +// RUN: %clang_cc1 -fno-rtti -fno-threadsafe-statics -verify %s -DNO_EXCEPTIONS -DNO_RTTI -DNO_THREADSAFE_STATICS // RUN: %clang_cc1 -fcoroutines-ts -DNO_EXCEPTIONS -DCOROUTINES -verify %s // expected-no-diagnostics @@ -22,19 +22,15 @@ // --- C++17 features --- -#if check(variadic_using, 0, 0, 0, 201611) // FIXME: provisional name -#error "wrong value for __cpp_variadic_using" -#endif - #if check(hex_float, 0, 0, 0, 201603) #error "wrong value for __cpp_hex_float" #endif -#if check(inline_variables, 0, 0, 0, 201606) // FIXME: provisional name +#if check(inline_variables, 0, 0, 0, 201606) #error "wrong value for __cpp_inline_variables" #endif -#if check(aligned_new, 0, 0, 0, 201606) // FIXME: provisional name +#if check(aligned_new, 0, 0, 0, 201606) #error "wrong value for __cpp_aligned_new" #endif @@ -52,7 +48,7 @@ // constexpr checked below -#if check(if_constexpr, 0, 0, 0, 201606) // FIXME: provisional name +#if check(if_constexpr, 0, 0, 0, 201606) #error "wrong value for __cpp_if_constexpr" #endif @@ -60,7 +56,11 @@ // static_assert checked below -#if check(template_auto, 0, 0, 0, 201606) // FIXME: provisional name +#if check(deduction_guides, 0, 0, 0, 201611) +#error "wrong value for __cpp_deduction_guides" +#endif + +#if check(template_auto, 0, 0, 0, 201606) #error "wrong value for __cpp_template_auto" #endif @@ -80,6 +80,10 @@ // inheriting_constructors checked below +#if check(variadic_using, 0, 0, 0, 201611) +#error "wrong value for __cpp_variadic_using" +#endif + #if check(aggregate_bases, 0, 0, 0, 201603) #error "wrong value for __cpp_aggregate_bases" #endif @@ -96,10 +100,6 @@ #error "wrong value for __cpp_template_template_args" #endif -#if check(deduction_guides, 0, 0, 0, 201611) // FIXME: provisional name -#error "wrong value for __cpp_deduction_guides" -#endif - // --- C++14 features --- #if check(binary_literals, 0, 0, 201304, 201304) @@ -163,6 +163,10 @@ #error "wrong value for __cpp_user_defined_literals" #endif +#if defined(NO_THREADSAFE_STATICS) ? check(threadsafe_static_init, 0, 0, 0, 0) : check(threadsafe_static_init, 200806, 200806, 200806, 200806) +#error "wrong value for __cpp_threadsafe_static_init" +#endif + #if check(lambdas, 0, 200907, 200907, 200907) #error "wrong value for __cpp_lambdas" #endif diff --git a/test/Lexer/hexfloat.cpp b/test/Lexer/hexfloat.cpp index 163db72f56f2..3241751a1233 100644 --- a/test/Lexer/hexfloat.cpp +++ b/test/Lexer/hexfloat.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -std=c++98 -fsyntax-only -verify -pedantic %s // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -pedantic %s // RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify -pedantic %s -// RUN: %clang_cc1 -std=c++1z -fsyntax-only -verify -pedantic %s +// RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify -pedantic %s double e = 0x.p0; // expected-error-re {{hexadecimal floating {{constant|literal}} requires a significand}} float f = 0x1p+1; @@ -9,10 +9,10 @@ double d = 0x.2p2; float g = 0x1.2p2; double h = 0x1.p2; #if __cplusplus <= 201402L -// expected-warning@-5 {{hexadecimal floating literals are a C++1z feature}} -// expected-warning@-5 {{hexadecimal floating literals are a C++1z feature}} -// expected-warning@-5 {{hexadecimal floating literals are a C++1z feature}} -// expected-warning@-5 {{hexadecimal floating literals are a C++1z feature}} +// expected-warning@-5 {{hexadecimal floating literals are a C++17 feature}} +// expected-warning@-5 {{hexadecimal floating literals are a C++17 feature}} +// expected-warning@-5 {{hexadecimal floating literals are a C++17 feature}} +// expected-warning@-5 {{hexadecimal floating literals are a C++17 feature}} #endif // PR12717: In order to minimally diverge from the C++ standard, we do not lex diff --git a/test/Modules/Inputs/innerstructredef.h b/test/Modules/Inputs/innerstructredef.h new file mode 100644 index 000000000000..600f44e41cf8 --- /dev/null +++ b/test/Modules/Inputs/innerstructredef.h @@ -0,0 +1,6 @@ +struct Outer { +// This definition is actually hidden since only submodule 'one' is imported. +struct Inner { + int x; +} field; +}; diff --git a/test/Modules/Inputs/module.map b/test/Modules/Inputs/module.map index 4cb3e8a02804..4788daa43166 100644 --- a/test/Modules/Inputs/module.map +++ b/test/Modules/Inputs/module.map @@ -451,3 +451,12 @@ module DebugNestedB { module objcAtKeywordMissingEnd { header "objcAtKeywordMissingEnd.h" } + +module innerstructredef { + module one { + header "empty.h" + } + module two { + header "innerstructredef.h" + } +} diff --git a/test/Modules/inner-struct-redefines-invisible.m b/test/Modules/inner-struct-redefines-invisible.m new file mode 100644 index 000000000000..ecf6d808df3d --- /dev/null +++ b/test/Modules/inner-struct-redefines-invisible.m @@ -0,0 +1,12 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fsyntax-only -I%S/Inputs -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -verify %s +// expected-no-diagnostics + +@import innerstructredef.one; + +struct Outer { +// Should set lexical context when parsing 'Inner' here, otherwise there's a crash: +struct Inner { + int x; +} field; +}; diff --git a/test/Parser/cxx0x-attributes.cpp b/test/Parser/cxx0x-attributes.cpp index 647762f165cb..5db06bd3f2a3 100644 --- a/test/Parser/cxx0x-attributes.cpp +++ b/test/Parser/cxx0x-attributes.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 -Wc++14-compat -Wc++14-extensions -Wc++1z-extensions %s +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 -Wc++14-compat -Wc++14-extensions -Wc++17-extensions %s // Need std::initializer_list namespace std { @@ -127,7 +127,7 @@ extern "C++" [[]] { } // expected-error {{an attribute list cannot appear here}} [[]] using ns::i; // expected-error {{an attribute list cannot appear here}} [[unknown]] using namespace ns; // expected-warning {{unknown attribute 'unknown' ignored}} [[noreturn]] using namespace ns; // expected-error {{'noreturn' attribute only applies to functions}} -namespace [[]] ns2 {} // expected-warning {{attributes on a namespace declaration are incompatible with C++ standards before C++1z}} +namespace [[]] ns2 {} // expected-warning {{attributes on a namespace declaration are incompatible with C++ standards before C++17}} using [[]] alignas(4) [[]] ns::i; // expected-error {{an attribute list cannot appear here}} using [[]] alignas(4) [[]] foobar = int; // expected-error {{an attribute list cannot appear here}} expected-error {{'alignas' attribute only applies to}} @@ -179,7 +179,7 @@ enum [[]] E2; // expected-error {{forbids forward references}} enum [[]] E1; enum [[]] E3 : int; enum [[]] { - k_123 [[]] = 123 // expected-warning {{attributes on an enumerator declaration are incompatible with C++ standards before C++1z}} + k_123 [[]] = 123 // expected-warning {{attributes on an enumerator declaration are incompatible with C++ standards before C++17}} }; enum [[]] E1 e; // expected-error {{an attribute list cannot appear here}} enum [[]] class E4 { }; // expected-error {{an attribute list cannot appear here}} @@ -352,7 +352,7 @@ int fallthru(int n) { switch (n) { case 0: n += 5; - [[fallthrough]]; // expected-warning {{use of the 'fallthrough' attribute is a C++1z extension}} + [[fallthrough]]; // expected-warning {{use of the 'fallthrough' attribute is a C++17 extension}} case 1: n *= 2; break; diff --git a/test/Parser/cxx1z-constexpr-lambdas.cpp b/test/Parser/cxx1z-constexpr-lambdas.cpp index ea000e361ccb..4cf3d1221167 100644 --- a/test/Parser/cxx1z-constexpr-lambdas.cpp +++ b/test/Parser/cxx1z-constexpr-lambdas.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++1z %s -verify +// RUN: %clang_cc1 -std=c++17 %s -verify // RUN: %clang_cc1 -std=c++14 %s -verify // RUN: %clang_cc1 -std=c++11 %s -verify @@ -23,9 +23,9 @@ auto XL16 = [] () constexpr { }; #else -auto L = []() mutable constexpr {return 0; }; //expected-warning{{is a C++1z extension}} -auto L2 = []() constexpr { return 0;};//expected-warning{{is a C++1z extension}} -auto L4 = []() constexpr mutable { return 0; }; //expected-warning{{is a C++1z extension}} +auto L = []() mutable constexpr {return 0; }; //expected-warning{{is a C++17 extension}} +auto L2 = []() constexpr { return 0;};//expected-warning{{is a C++17 extension}} +auto L4 = []() constexpr mutable { return 0; }; //expected-warning{{is a C++17 extension}} #endif diff --git a/test/Parser/cxx1z-nested-namespace-definition.cpp b/test/Parser/cxx1z-nested-namespace-definition.cpp index 96f34c540acc..e5e809aa0366 100644 --- a/test/Parser/cxx1z-nested-namespace-definition.cpp +++ b/test/Parser/cxx1z-nested-namespace-definition.cpp @@ -2,13 +2,13 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s // RUN: not %clang_cc1 -x c++ -fixit %t -Werror -DFIXIT // RUN: %clang_cc1 -x c++ %t -DFIXIT -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++1z -Wc++14-compat +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++17 -Wc++14-compat namespace foo1::foo2::foo3 { #if __cplusplus <= 201400L -// expected-warning@-2 {{nested namespace definition is a C++1z extension; define each namespace separately}} +// expected-warning@-2 {{nested namespace definition is a C++17 extension; define each namespace separately}} #else -// expected-warning@-4 {{nested namespace definition is incompatible with C++ standards before C++1z}} +// expected-warning@-4 {{nested namespace definition is incompatible with C++ standards before C++17}} #endif int foo(int x) { return x; } } diff --git a/test/Preprocessor/init.c b/test/Preprocessor/init.c index 3a8e5dbd3fd8..5a77d06d2403 100644 --- a/test/Preprocessor/init.c +++ b/test/Preprocessor/init.c @@ -4686,6 +4686,16 @@ // RUN: | FileCheck -match-full-lines -check-prefix MIPS-MSA %s // MIPS-MSA:#define __mips_msa 1 // +// RUN: %clang_cc1 -target-feature +nomadd4 \ +// RUN: -E -dM -triple=mips-none-none < /dev/null \ +// RUN: | FileCheck -match-full-lines -check-prefix MIPS-NOMADD4 %s +// MIPS-NOMADD4:#define __mips_no_madd4 1 +// +// RUN: %clang_cc1 \ +// RUN: -E -dM -triple=mips-none-none < /dev/null \ +// RUN: | FileCheck -match-full-lines -check-prefix MIPS-MADD4 %s +// MIPS-MADD4-NOT:#define __mips_no_madd4 1 +// // RUN: %clang_cc1 -target-cpu mips32r3 -target-feature +nan2008 \ // RUN: -E -dM -triple=mips-none-none < /dev/null \ // RUN: | FileCheck -match-full-lines -check-prefix MIPS-NAN2008 %s diff --git a/test/SemaCUDA/function-overload.cu b/test/SemaCUDA/function-overload.cu index 3d4c29c42cee..adf488b5eea3 100644 --- a/test/SemaCUDA/function-overload.cu +++ b/test/SemaCUDA/function-overload.cu @@ -222,7 +222,7 @@ GlobalFnPtr fp_g = g; // Test overloading of destructors // Can't mix H and unattributed destructors struct d_h { - ~d_h() {} // expected-note {{previous declaration is here}} + ~d_h() {} // expected-note {{previous definition is here}} __host__ ~d_h() {} // expected-error {{destructor cannot be redeclared}} }; diff --git a/test/SemaCUDA/no-destructor-overload.cu b/test/SemaCUDA/no-destructor-overload.cu index aa6971ee8ca8..32dbb8db76ec 100644 --- a/test/SemaCUDA/no-destructor-overload.cu +++ b/test/SemaCUDA/no-destructor-overload.cu @@ -7,27 +7,27 @@ // giant change to clang, and the use cases seem quite limited. struct A { - ~A() {} // expected-note {{previous declaration is here}} + ~A() {} // expected-note {{previous definition is here}} __device__ ~A() {} // expected-error {{destructor cannot be redeclared}} }; struct B { - __host__ ~B() {} // expected-note {{previous declaration is here}} + __host__ ~B() {} // expected-note {{previous definition is here}} __host__ __device__ ~B() {} // expected-error {{destructor cannot be redeclared}} }; struct C { - __host__ __device__ ~C() {} // expected-note {{previous declaration is here}} + __host__ __device__ ~C() {} // expected-note {{previous definition is here}} __host__ ~C() {} // expected-error {{destructor cannot be redeclared}} }; struct D { - __device__ ~D() {} // expected-note {{previous declaration is here}} + __device__ ~D() {} // expected-note {{previous definition is here}} __host__ __device__ ~D() {} // expected-error {{destructor cannot be redeclared}} }; struct E { - __host__ __device__ ~E() {} // expected-note {{previous declaration is here}} + __host__ __device__ ~E() {} // expected-note {{previous definition is here}} __device__ ~E() {} // expected-error {{destructor cannot be redeclared}} }; diff --git a/test/SemaCXX/constant-expression-cxx1y.cpp b/test/SemaCXX/constant-expression-cxx1y.cpp index ac4e0fd471ae..0c0cb0ec58a1 100644 --- a/test/SemaCXX/constant-expression-cxx1y.cpp +++ b/test/SemaCXX/constant-expression-cxx1y.cpp @@ -982,3 +982,9 @@ constexpr void PR28739(int n) { // expected-error {{never produces a constant}} int *p = &n; p += (__int128)(unsigned long)-1; // expected-note {{cannot refer to element 18446744073709551615 of non-array object in a constant expression}} } + +constexpr void Void(int n) { + void(n + 1); + void(); +} +constexpr int void_test = (Void(0), 1); diff --git a/test/SemaCXX/cxx0x-compat.cpp b/test/SemaCXX/cxx0x-compat.cpp index bcf0cf11dc18..8f7aaab6a438 100644 --- a/test/SemaCXX/cxx0x-compat.cpp +++ b/test/SemaCXX/cxx0x-compat.cpp @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -std=c++98 -Wc++11-compat -verify %s -// RUN: %clang_cc1 -fsyntax-only -std=c++1z -Wc++11-compat -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c++17 -Wc++11-compat -verify %s #if __cplusplus < 201103L @@ -42,14 +42,14 @@ void h(size_t foo, size_t bar) { char c = 'x'_x; // expected-warning {{will be treated as a user-defined literal suffix}} template int f() { // expected-warning {{C++11 extension}} - return (N + ...); // expected-warning {{C++1z extension}} + return (N + ...); // expected-warning {{C++17 extension}} } #else auto init_capture = [a(0)] {}; // expected-warning {{initialized lambda captures are incompatible with C++ standards before C++14}} -static_assert(true); // expected-warning {{incompatible with C++ standards before C++1z}} +static_assert(true); // expected-warning {{incompatible with C++ standards before C++17}} -template int f() { return (N + ...); } // expected-warning {{incompatible with C++ standards before C++1z}} +template int f() { return (N + ...); } // expected-warning {{incompatible with C++ standards before C++17}} #endif diff --git a/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp b/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp index 668c24280258..9232a8b6eba0 100644 --- a/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp +++ b/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp @@ -286,6 +286,29 @@ namespace tuple_tests { } } +namespace dependent { + template struct X { + X(T); + }; + template int Var(T t) { + X x(t); + return X(x) + 1; // expected-error {{invalid operands}} + } + template int Cast(T t) { + return X(X(t)) + 1; // expected-error {{invalid operands}} + } + template int New(T t) { + return X(new X(t)) + 1; // expected-error {{invalid operands}} + }; + template int Var(float); // expected-note {{instantiation of}} + template int Cast(float); // expected-note {{instantiation of}} + template int New(float); // expected-note {{instantiation of}} + template int operator+(X, int); + template int Var(int); + template int Cast(int); + template int New(int); +} + #else // expected-no-diagnostics diff --git a/test/SemaCXX/cxx1z-init-statement.cpp b/test/SemaCXX/cxx1z-init-statement.cpp index 4afe0402d13f..d37acd08ce77 100644 --- a/test/SemaCXX/cxx1z-init-statement.cpp +++ b/test/SemaCXX/cxx1z-init-statement.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++1z -verify %s +// RUN: %clang_cc1 -std=c++17 -verify %s void testIf() { int x = 0; diff --git a/test/SemaCXX/deprecated.cpp b/test/SemaCXX/deprecated.cpp index ac477d4b66bc..26f30c91b098 100644 --- a/test/SemaCXX/deprecated.cpp +++ b/test/SemaCXX/deprecated.cpp @@ -1,9 +1,9 @@ // RUN: %clang_cc1 -std=c++98 %s -Wdeprecated -verify -triple x86_64-linux-gnu // RUN: %clang_cc1 -std=c++11 %s -Wdeprecated -verify -triple x86_64-linux-gnu -// RUN: %clang_cc1 -std=c++1y %s -Wdeprecated -verify -triple x86_64-linux-gnu -// RUN: %clang_cc1 -std=c++1z %s -Wdeprecated -verify -triple x86_64-linux-gnu +// RUN: %clang_cc1 -std=c++14 %s -Wdeprecated -verify -triple x86_64-linux-gnu +// RUN: %clang_cc1 -std=c++17 %s -Wdeprecated -verify -triple x86_64-linux-gnu -// RUN: %clang_cc1 -std=c++1y %s -Wdeprecated -verify -triple x86_64-linux-gnu -Wno-deprecated-register -DNO_DEPRECATED_FLAGS +// RUN: %clang_cc1 -std=c++14 %s -Wdeprecated -verify -triple x86_64-linux-gnu -Wno-deprecated-register -DNO_DEPRECATED_FLAGS #include "Inputs/register.h" @@ -12,8 +12,8 @@ void h() throw(int); void i() throw(...); #if __cplusplus > 201402L // expected-warning@-4 {{dynamic exception specifications are deprecated}} expected-note@-4 {{use 'noexcept' instead}} -// expected-error@-4 {{ISO C++1z does not allow dynamic exception specifications}} expected-note@-4 {{use 'noexcept(false)' instead}} -// expected-error@-4 {{ISO C++1z does not allow dynamic exception specifications}} expected-note@-4 {{use 'noexcept(false)' instead}} +// expected-error@-4 {{ISO C++17 does not allow dynamic exception specifications}} expected-note@-4 {{use 'noexcept(false)' instead}} +// expected-error@-4 {{ISO C++17 does not allow dynamic exception specifications}} expected-note@-4 {{use 'noexcept(false)' instead}} #elif __cplusplus >= 201103L // expected-warning@-8 {{dynamic exception specifications are deprecated}} expected-note@-8 {{use 'noexcept' instead}} // expected-warning@-8 {{dynamic exception specifications are deprecated}} expected-note@-8 {{use 'noexcept(false)' instead}} @@ -23,7 +23,7 @@ void i() throw(...); void stuff() { register int n; #if __cplusplus > 201402L - // expected-error@-2 {{ISO C++1z does not allow 'register' storage class specifier}} + // expected-error@-2 {{ISO C++17 does not allow 'register' storage class specifier}} #elif __cplusplus >= 201103L && !defined(NO_DEPRECATED_FLAGS) // expected-warning@-4 {{'register' storage class specifier is deprecated}} #endif @@ -34,14 +34,14 @@ void stuff() { bool b; ++b; #if __cplusplus > 201402L - // expected-error@-2 {{ISO C++1z does not allow incrementing expression of type bool}} + // expected-error@-2 {{ISO C++17 does not allow incrementing expression of type bool}} #else // expected-warning@-4 {{incrementing expression of type bool is deprecated}} #endif b++; #if __cplusplus > 201402L - // expected-error@-2 {{ISO C++1z does not allow incrementing expression of type bool}} + // expected-error@-2 {{ISO C++17 does not allow incrementing expression of type bool}} #else // expected-warning@-4 {{incrementing expression of type bool is deprecated}} #endif diff --git a/test/SemaCXX/inline.cpp b/test/SemaCXX/inline.cpp index b20bc18d0a3f..ba29521ce504 100644 --- a/test/SemaCXX/inline.cpp +++ b/test/SemaCXX/inline.cpp @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s // RUN: %clang_cc1 -fsyntax-only -verify -std=c++14 %s -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++1z %s -Wc++98-c++11-c++14-compat +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++17 %s -Wc++98-c++11-c++14-compat // Check that we don't allow illegal uses of inline // (checking C++-only constructs here) @@ -12,7 +12,7 @@ void localVar() { // Check that we warn appropriately. #if __cplusplus <= 201402L -inline int a; // expected-warning{{inline variables are a C++1z extension}} +inline int a; // expected-warning{{inline variables are a C++17 extension}} #else -inline int a; // expected-warning{{inline variables are incompatible with C++ standards before C++1z}} +inline int a; // expected-warning{{inline variables are incompatible with C++ standards before C++17}} #endif diff --git a/test/SemaCXX/static-assert.cpp b/test/SemaCXX/static-assert.cpp index 7de4d07b50b8..196375c3d687 100644 --- a/test/SemaCXX/static-assert.cpp +++ b/test/SemaCXX/static-assert.cpp @@ -49,5 +49,5 @@ struct X { ~X(); }; StaticAssertProtected sap1; StaticAssertProtected sap2; // expected-note {{instantiation}} -static_assert(true); // expected-warning {{C++1z extension}} +static_assert(true); // expected-warning {{C++17 extension}} static_assert(false); // expected-error-re {{failed{{$}}}} expected-warning {{extension}} diff --git a/test/SemaCXX/warn-c++1z-extensions.cpp b/test/SemaCXX/warn-c++1z-extensions.cpp index 9b5e1c205cf3..a0d44a34ffed 100644 --- a/test/SemaCXX/warn-c++1z-extensions.cpp +++ b/test/SemaCXX/warn-c++1z-extensions.cpp @@ -1,8 +1,8 @@ // RUN: %clang_cc1 -fsyntax-only -std=c++14 -verify %s void f() { - if (bool b = true; b) {} // expected-warning {{'if' initialization statements are a C++1z extension}} - switch (int n = 5; n) { // expected-warning {{'switch' initialization statements are a C++1z extension}} + if (bool b = true; b) {} // expected-warning {{'if' initialization statements are a C++17 extension}} + switch (int n = 5; n) { // expected-warning {{'switch' initialization statements are a C++17 extension}} case 5: break; } } diff --git a/test/SemaCXX/warn-shadow.cpp b/test/SemaCXX/warn-shadow.cpp index d5f0623eb320..3d09c786285a 100644 --- a/test/SemaCXX/warn-shadow.cpp +++ b/test/SemaCXX/warn-shadow.cpp @@ -213,3 +213,12 @@ typedef int externC; // expected-note {{previous declaration is here}} void handleLinkageSpec() { typedef void externC; // expected-warning {{declaration shadows a typedef in the global namespace}} } + +namespace PR33947 { +void f(int a) { + struct A { + void g(int a) {} + A() { int a; } + }; +} +} diff --git a/test/SemaObjC/illegal-nonarc-bridged-cast.m b/test/SemaObjC/illegal-nonarc-bridged-cast.m index f3406ef983cc..23c7b96e3709 100644 --- a/test/SemaObjC/illegal-nonarc-bridged-cast.m +++ b/test/SemaObjC/illegal-nonarc-bridged-cast.m @@ -1,8 +1,9 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fblocks -verify %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fblocks -Wcast-qual -verify %s // rdar://10597832 typedef const void *CFTypeRef; typedef const struct __CFString *CFStringRef; +@class NSString; @interface NSString @end @@ -18,7 +19,7 @@ NSString *CreateNSString(); void from_cf() { id obj1 = (__bridge_transfer id)CFCreateSomething(); // expected-warning {{'__bridge_transfer' casts have no effect when not using ARC}} id obj2 = (__bridge_transfer NSString*)CFCreateString(); // expected-warning {{'__bridge_transfer' casts have no effect when not using ARC}} - (__bridge int*)CFCreateSomething(); // expected-warning {{expression result unused}} + (__bridge int*)CFCreateSomething(); // expected-warning {{expression result unused}} expected-warning {{cast from 'const void *' to 'int *' drops const qualifier}} id obj3 = (__bridge id)CFGetSomething(); id obj4 = (__bridge NSString*)CFGetString(); } @@ -41,3 +42,15 @@ void to_cf_ignored(id obj) { CFTypeRef cf1 = (__bridge_retained CFTypeRef)CreateSomething(); // no-warning CFTypeRef cf3 = (__bridge CFTypeRef)CreateSomething(); // no-warning } + +// Check that clang doesn't warn about dropping const from Objective-C object +// types. +void test_wcast_qual() { + CFStringRef c; + NSString *n0 = (NSString *)c; + NSString **n1 = (NSString **)&c; + const NSString *n2; + const NSString **n3; + void *p0 = (void *)n2; + void **p1 = (void **)n3; +} diff --git a/test/SemaTemplate/temp_arg_nontype_cxx11.cpp b/test/SemaTemplate/temp_arg_nontype_cxx11.cpp index cfaad0cd0c96..0b8f0eed1601 100644 --- a/test/SemaTemplate/temp_arg_nontype_cxx11.cpp +++ b/test/SemaTemplate/temp_arg_nontype_cxx11.cpp @@ -25,7 +25,7 @@ namespace CanonicalNullptr { } namespace Auto { - template struct A { }; // expected-error {{until C++1z}} + template struct A { }; // expected-error {{until C++17}} } namespace check_conversion_early { diff --git a/www/cxx_dr_status.html b/www/cxx_dr_status.html index b03b3f0ef9c2..2a326e76aa6a 100644 --- a/www/cxx_dr_status.html +++ b/www/cxx_dr_status.html @@ -28,7 +28,7 @@

C++ Defect Report Support in Clang

-

Last updated: $Date: 2017-05-10 00:21:24 +0200 (Wed, 10 May 2017) $

+

Last updated: $Date: 2017-08-11 18:07:17 +0200 (Fri, 11 Aug 2017) $

C++ defect report implementation status

@@ -591,7 +591,7 @@ 92 CD4 Should exception-specifications be part of the type system? - Clang 4 (C++17 onwards) + Clang 4 (C++17 onwards) 93 @@ -813,7 +813,7 @@ 129 CD3 Stability of uninitialized auto variables - Duplicate of 616 + Duplicate of 616 130 @@ -1480,7 +1480,7 @@ accessible? 240 CD3 Uninitialized values and undefined behavior - Duplicate of 616 + Duplicate of 616 241 @@ -1594,7 +1594,7 @@ accessible? 259 CD1 Restrictions on explicit specialization and instantiation - Clang 4 + Clang 4 260 @@ -1913,7 +1913,7 @@ of class templates 312 CD3 “use” of invalid pointer value not defined - Duplicate of 616 + Duplicate of 616 313 @@ -2279,7 +2279,7 @@ of class templates 373 C++11 Lookup on namespace qualified name in using-directive - SVN + Clang 5 374 @@ -3017,7 +3017,7 @@ of class templates 496 CD3 Is a volatile-qualified type really a POD? - Superseded by dr2094 + Superseded by 2094 497 @@ -3541,7 +3541,7 @@ and POD class 583 CD3 Relational pointer comparisons against the null pointer constant - Clang 4 + Clang 4 584 @@ -3613,7 +3613,7 @@ and POD class 595 dup Exception specifications in templates instantiated from class bodies - Duplicate of 1330 + Duplicate of 1330 596 @@ -3739,7 +3739,7 @@ and POD class 616 CD3 Definition of “indeterminate value” - Clang 4 + Clang 4 617 @@ -5839,7 +5839,7 @@ and POD class 1004 C++11 Injected-class-names as arguments for template template parameters - SVN + Clang 5 1005 @@ -7093,7 +7093,7 @@ and POD class 1213 CD3 Array subscripting and xvalues - Clang 4 + Clang 4 1214 @@ -7405,7 +7405,7 @@ and POD class 1265 CD3 Mixed use of the auto specifier - SVN + Clang 5 1266 @@ -7585,7 +7585,7 @@ and POD class 1295 CD3 Binding a reference to an rvalue bit-field - Clang 4 + Clang 4 1296 @@ -7675,7 +7675,7 @@ and POD class 1310 CD3 What is an “acceptable lookup result?” - SVN + Clang 5 1311 @@ -7795,7 +7795,7 @@ and POD class 1330 CD3 Delayed instantiation of noexcept specifiers - Clang 4 (C++11 onwards) + Clang 4 (C++11 onwards) 1331 @@ -8143,7 +8143,7 @@ and POD class 1388 CD3 Missing non-deduced context following a function parameter pack - Clang 4 + Clang 4 1389 @@ -8209,7 +8209,7 @@ and POD class 1399 CD3 Deduction with multiple function parameter packs - Duplicate of 1388 + Duplicate of 1388 1400 @@ -8785,7 +8785,7 @@ and POD class 1495 CD3 Partial specialization of variadic class template - Clang 4 + Clang 4 1496 @@ -8887,7 +8887,7 @@ and POD class 1512 CD3 Pointer comparison vs qualification conversions - Clang 4 + Clang 4 1513 @@ -8923,7 +8923,7 @@ and POD class 1518 CD4 Explicit default constructors and copy-list-initialization - Clang 4 + Clang 4 1519 @@ -9733,7 +9733,7 @@ and POD class 1653 CD4 Removing deprecated increment of bool - Clang 4 (C++17 onwards) + Clang 4 (C++17 onwards) 1654 @@ -9763,7 +9763,7 @@ and POD class 1658 C++14 Deleted default constructor for abstract class via destructor - SVN + Clang 5 1659 @@ -11161,7 +11161,7 @@ and POD class 1891 CD4 Move constructor/assignment for closure class - Clang 4 + Clang 4 1892 @@ -12379,7 +12379,7 @@ and POD class 2094 DR Trivial copy/move constructor for class with volatile member - Clang 5.0 + Clang 5 2095 diff --git a/www/cxx_status.html b/www/cxx_status.html index 39c3147ca47c..4a4d44bd3679 100644 --- a/www/cxx_status.html +++ b/www/cxx_status.html @@ -26,7 +26,7 @@

C++ Support in Clang

-

Last updated: $Date: 2017-07-15 17:51:59 +0200 (Sat, 15 Jul 2017) $

+

Last updated: $Date: 2017-08-11 18:16:08 +0200 (Fri, 11 Aug 2017) $

Clang fully implements all published ISO C++ standards (C++98 / C++03, Available in Clang? - SD-6: SG10 feature test recommendations - SD-6 - N/A + SD-6: SG10 feature test recommendations + SD-6 + N/A Clang 3.4 (N3745)
@@ -871,6 +871,11 @@ and library features that are not part of standard C++.

Clang 4 (P0096R3) + + + Clang 5 (P0096R4) + +