diff options
Diffstat (limited to 'contrib/llvm-project/llvm')
15 files changed, 76 insertions, 94 deletions
diff --git a/contrib/llvm-project/llvm/include/llvm/ExecutionEngine/JITLink/JITLinkDylib.h b/contrib/llvm-project/llvm/include/llvm/ExecutionEngine/JITLink/JITLinkDylib.h index 2aa88cb50074..6bb1b5a285b1 100644 --- a/contrib/llvm-project/llvm/include/llvm/ExecutionEngine/JITLink/JITLinkDylib.h +++ b/contrib/llvm-project/llvm/include/llvm/ExecutionEngine/JITLink/JITLinkDylib.h @@ -13,10 +13,21 @@ #ifndef LLVM_EXECUTIONENGINE_JITLINK_JITLINKDYLIB_H #define LLVM_EXECUTIONENGINE_JITLINK_JITLINKDYLIB_H +#include <string> + namespace llvm { namespace jitlink { -class JITLinkDylib {}; +class JITLinkDylib { +public: + JITLinkDylib(std::string Name) : Name(std::move(Name)) {} + + /// Get the name for this JITLinkDylib. + const std::string &getName() const { return Name; } + +private: + std::string Name; +}; } // end namespace jitlink } // end namespace llvm diff --git a/contrib/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/Core.h b/contrib/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/Core.h index 5cac65b49a05..362e8ab8e296 100644 --- a/contrib/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/Core.h +++ b/contrib/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/Core.h @@ -927,17 +927,11 @@ class JITDylib : public ThreadSafeRefCountedBase<JITDylib>, friend class MaterializationResponsibility; public: - using AsynchronousSymbolQuerySet = - std::set<std::shared_ptr<AsynchronousSymbolQuery>>; - JITDylib(const JITDylib &) = delete; JITDylib &operator=(const JITDylib &) = delete; JITDylib(JITDylib &&) = delete; JITDylib &operator=(JITDylib &&) = delete; - /// Get the name for this JITDylib. - const std::string &getName() const { return JITDylibName; } - /// Get a reference to the ExecutionSession for this JITDylib. ExecutionSession &getExecutionSession() const { return ES; } @@ -1070,6 +1064,9 @@ public: std::vector<JITDylibSP> getReverseDFSLinkOrder(); private: + using AsynchronousSymbolQuerySet = + std::set<std::shared_ptr<AsynchronousSymbolQuery>>; + using AsynchronousSymbolQueryList = std::vector<std::shared_ptr<AsynchronousSymbolQuery>>; @@ -1200,7 +1197,6 @@ private: failSymbols(FailedSymbolsWorklist); ExecutionSession &ES; - std::string JITDylibName; std::mutex GeneratorsMutex; bool Open = true; SymbolTable Symbols; diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp index dcabefb9896e..fb0798f204e1 100644 --- a/contrib/llvm-project/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp +++ b/contrib/llvm-project/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp @@ -1289,16 +1289,14 @@ DWARFVerifier::verifyNameIndexAbbrevs(const DWARFDebugNames::NameIndex &NI) { static SmallVector<StringRef, 2> getNames(const DWARFDie &DIE, bool IncludeLinkageName = true) { SmallVector<StringRef, 2> Result; - if (const char *Str = DIE.getName(DINameKind::ShortName)) + if (const char *Str = DIE.getShortName()) Result.emplace_back(Str); else if (DIE.getTag() == dwarf::DW_TAG_namespace) Result.emplace_back("(anonymous namespace)"); if (IncludeLinkageName) { - if (const char *Str = DIE.getName(DINameKind::LinkageName)) { - if (Result.empty() || Result[0] != Str) - Result.emplace_back(Str); - } + if (const char *Str = DIE.getLinkageName()) + Result.emplace_back(Str); } return Result; diff --git a/contrib/llvm-project/llvm/lib/ExecutionEngine/Orc/Core.cpp b/contrib/llvm-project/llvm/lib/ExecutionEngine/Orc/Core.cpp index 64e5090e4c53..6b24d6461b63 100644 --- a/contrib/llvm-project/llvm/lib/ExecutionEngine/Orc/Core.cpp +++ b/contrib/llvm-project/llvm/lib/ExecutionEngine/Orc/Core.cpp @@ -1364,7 +1364,7 @@ Error JITDylib::remove(const SymbolNameSet &Names) { void JITDylib::dump(raw_ostream &OS) { ES.runSessionLocked([&, this]() { - OS << "JITDylib \"" << JITDylibName << "\" (ES: " + OS << "JITDylib \"" << getName() << "\" (ES: " << format("0x%016" PRIx64, reinterpret_cast<uintptr_t>(&ES)) << "):\n" << "Link order: " << LinkOrder << "\n" << "Symbol table:\n"; @@ -1450,7 +1450,7 @@ JITDylib::MaterializingInfo::takeQueriesMeeting(SymbolState RequiredState) { } JITDylib::JITDylib(ExecutionSession &ES, std::string Name) - : ES(ES), JITDylibName(std::move(Name)) { + : JITLinkDylib(std::move(Name)), ES(ES) { LinkOrder.push_back({this, JITDylibLookupFlags::MatchAllSymbols}); } diff --git a/contrib/llvm-project/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCAsmInfo.cpp b/contrib/llvm-project/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCAsmInfo.cpp index 5c728bd86817..7708579a4491 100644 --- a/contrib/llvm-project/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCAsmInfo.cpp +++ b/contrib/llvm-project/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCAsmInfo.cpp @@ -28,7 +28,6 @@ AMDGPUMCAsmInfo::AMDGPUMCAsmInfo(const Triple &TT, MaxInstLength = (TT.getArch() == Triple::amdgcn) ? 20 : 16; SeparatorString = "\n"; CommentString = ";"; - PrivateLabelPrefix = ""; InlineAsmStart = ";#ASMSTART"; InlineAsmEnd = ";#ASMEND"; diff --git a/contrib/llvm-project/llvm/lib/Target/ARM/Thumb2SizeReduction.cpp b/contrib/llvm-project/llvm/lib/Target/ARM/Thumb2SizeReduction.cpp index 0f7e19038673..132516694f4e 100644 --- a/contrib/llvm-project/llvm/lib/Target/ARM/Thumb2SizeReduction.cpp +++ b/contrib/llvm-project/llvm/lib/Target/ARM/Thumb2SizeReduction.cpp @@ -718,7 +718,7 @@ Thumb2SizeReduce::ReduceSpecial(MachineBasicBlock &MBB, MachineInstr *MI, case ARM::t2CMPrr: { // Try to reduce to the lo-reg only version first. Why there are two // versions of the instruction is a mystery. - // It would be nice to just have two entries in the master table that + // It would be nice to just have two entries in the main table that // are prioritized, but the table assumes a unique entry for each // source insn opcode. So for now, we hack a local entry record to use. static const ReduceEntry NarrowEntry = diff --git a/contrib/llvm-project/llvm/lib/Target/Hexagon/HexagonMachineScheduler.cpp b/contrib/llvm-project/llvm/lib/Target/Hexagon/HexagonMachineScheduler.cpp index 47bebf77b31b..60d58f421bbb 100644 --- a/contrib/llvm-project/llvm/lib/Target/Hexagon/HexagonMachineScheduler.cpp +++ b/contrib/llvm-project/llvm/lib/Target/Hexagon/HexagonMachineScheduler.cpp @@ -121,7 +121,7 @@ bool VLIWResourceModel::isResourceAvailable(SUnit *SU, bool IsTop) { const auto &QII = *QST.getInstrInfo(); // Now see if there are no other dependencies to instructions already - // in the packet. + // in the packet. if (IsTop) { for (unsigned i = 0, e = Packet.size(); i != e; ++i) if (hasDependence(Packet[i], SU, QII)) diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp b/contrib/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp index dba0321d9431..17d14053d804 100644 --- a/contrib/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/contrib/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -44004,7 +44004,11 @@ static SDValue combineSetCCMOVMSK(SDValue EFLAGS, X86::CondCode &CC, // signbits extend down to all the sub-elements as well. // Calling MOVMSK with the wider type, avoiding the bitcast, helps expose // potential SimplifyDemandedBits/Elts cases. - if (Vec.getOpcode() == ISD::BITCAST) { + // If we looked through a truncate that discard bits, we can't do this + // transform. + // FIXME: We could do this transform for truncates that discarded bits by + // inserting an AND mask between the new MOVMSK and the CMP. + if (Vec.getOpcode() == ISD::BITCAST && NumElts <= CmpBits) { SDValue BC = peekThroughBitcasts(Vec); MVT BCVT = BC.getSimpleValueType(); unsigned BCNumElts = BCVT.getVectorNumElements(); diff --git a/contrib/llvm-project/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp b/contrib/llvm-project/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp index ad21fec269ec..36a66e096382 100644 --- a/contrib/llvm-project/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp +++ b/contrib/llvm-project/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp @@ -692,7 +692,7 @@ void InstrProfiling::lowerIncrement(InstrProfIncrementInst *Inc) { IRBuilder<> Builder(Inc); uint64_t Index = Inc->getIndex()->getZExtValue(); - Value *Addr = Builder.CreateConstInBoundsGEP2_64(Counters->getValueType(), + Value *Addr = Builder.CreateConstInBoundsGEP2_32(Counters->getValueType(), Counters, 0, Index); if (isRuntimeCounterRelocationEnabled()) { diff --git a/contrib/llvm-project/llvm/lib/Transforms/Utils/CloneModule.cpp b/contrib/llvm-project/llvm/lib/Transforms/Utils/CloneModule.cpp index eb226b9b246d..200deca4b317 100644 --- a/contrib/llvm-project/llvm/lib/Transforms/Utils/CloneModule.cpp +++ b/contrib/llvm-project/llvm/lib/Transforms/Utils/CloneModule.cpp @@ -58,17 +58,13 @@ std::unique_ptr<Module> llvm::CloneModule( // new module. Here we add them to the VMap and to the new Module. We // don't worry about attributes or initializers, they will come later. // - for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); - I != E; ++I) { - GlobalVariable *GV = new GlobalVariable(*New, - I->getValueType(), - I->isConstant(), I->getLinkage(), - (Constant*) nullptr, I->getName(), - (GlobalVariable*) nullptr, - I->getThreadLocalMode(), - I->getType()->getAddressSpace()); - GV->copyAttributesFrom(&*I); - VMap[&*I] = GV; + for (const GlobalVariable &I : M.globals()) { + GlobalVariable *NewGV = new GlobalVariable( + *New, I.getValueType(), I.isConstant(), I.getLinkage(), + (Constant *)nullptr, I.getName(), (GlobalVariable *)nullptr, + I.getThreadLocalMode(), I.getType()->getAddressSpace()); + NewGV->copyAttributesFrom(&I); + VMap[&I] = NewGV; } // Loop over the functions in the module, making external functions as before @@ -81,34 +77,33 @@ std::unique_ptr<Module> llvm::CloneModule( } // Loop over the aliases in the module - for (Module::const_alias_iterator I = M.alias_begin(), E = M.alias_end(); - I != E; ++I) { - if (!ShouldCloneDefinition(&*I)) { + for (const GlobalAlias &I : M.aliases()) { + if (!ShouldCloneDefinition(&I)) { // An alias cannot act as an external reference, so we need to create // either a function or a global variable depending on the value type. // FIXME: Once pointee types are gone we can probably pick one or the // other. GlobalValue *GV; - if (I->getValueType()->isFunctionTy()) - GV = Function::Create(cast<FunctionType>(I->getValueType()), - GlobalValue::ExternalLinkage, - I->getAddressSpace(), I->getName(), New.get()); + if (I.getValueType()->isFunctionTy()) + GV = Function::Create(cast<FunctionType>(I.getValueType()), + GlobalValue::ExternalLinkage, I.getAddressSpace(), + I.getName(), New.get()); else - GV = new GlobalVariable( - *New, I->getValueType(), false, GlobalValue::ExternalLinkage, - nullptr, I->getName(), nullptr, - I->getThreadLocalMode(), I->getType()->getAddressSpace()); - VMap[&*I] = GV; + GV = new GlobalVariable(*New, I.getValueType(), false, + GlobalValue::ExternalLinkage, nullptr, + I.getName(), nullptr, I.getThreadLocalMode(), + I.getType()->getAddressSpace()); + VMap[&I] = GV; // We do not copy attributes (mainly because copying between different // kinds of globals is forbidden), but this is generally not required for // correctness. continue; } - auto *GA = GlobalAlias::create(I->getValueType(), - I->getType()->getPointerAddressSpace(), - I->getLinkage(), I->getName(), New.get()); - GA->copyAttributesFrom(&*I); - VMap[&*I] = GA; + auto *GA = GlobalAlias::create(I.getValueType(), + I.getType()->getPointerAddressSpace(), + I.getLinkage(), I.getName(), New.get()); + GA->copyAttributesFrom(&I); + VMap[&I] = GA; } // Now that all of the things that global variable initializer can refer to @@ -153,10 +148,9 @@ std::unique_ptr<Module> llvm::CloneModule( } Function::arg_iterator DestI = F->arg_begin(); - for (Function::const_arg_iterator J = I.arg_begin(); J != I.arg_end(); - ++J) { - DestI->setName(J->getName()); - VMap[&*J] = &*DestI++; + for (const Argument &J : I.args()) { + DestI->setName(J.getName()); + VMap[&J] = &*DestI++; } SmallVector<ReturnInst *, 8> Returns; // Ignore returns cloned. @@ -170,21 +164,17 @@ std::unique_ptr<Module> llvm::CloneModule( } // And aliases - for (Module::const_alias_iterator I = M.alias_begin(), E = M.alias_end(); - I != E; ++I) { + for (const GlobalAlias &I : M.aliases()) { // We already dealt with undefined aliases above. - if (!ShouldCloneDefinition(&*I)) + if (!ShouldCloneDefinition(&I)) continue; - GlobalAlias *GA = cast<GlobalAlias>(VMap[&*I]); - if (const Constant *C = I->getAliasee()) + GlobalAlias *GA = cast<GlobalAlias>(VMap[&I]); + if (const Constant *C = I.getAliasee()) GA->setAliasee(MapValue(C, VMap)); } // And named metadata.... - for (Module::const_named_metadata_iterator I = M.named_metadata_begin(), - E = M.named_metadata_end(); - I != E; ++I) { - const NamedMDNode &NMD = *I; + for (const NamedMDNode &NMD : M.named_metadata()) { NamedMDNode *NewNMD = New->getOrInsertNamedMetadata(NMD.getName()); for (unsigned i = 0, e = NMD.getNumOperands(); i != e; ++i) NewNMD->addOperand(MapMetadata(NMD.getOperand(i), VMap)); diff --git a/contrib/llvm-project/llvm/lib/Transforms/Utils/Evaluator.cpp b/contrib/llvm-project/llvm/lib/Transforms/Utils/Evaluator.cpp index 9c8aed94708e..91630d876fc8 100644 --- a/contrib/llvm-project/llvm/lib/Transforms/Utils/Evaluator.cpp +++ b/contrib/llvm-project/llvm/lib/Transforms/Utils/Evaluator.cpp @@ -285,9 +285,8 @@ bool Evaluator::getFormalParams(CallBase &CB, Function *F, } auto ArgI = CB.arg_begin(); - for (auto ParI = FTy->param_begin(), ParE = FTy->param_end(); ParI != ParE; - ++ParI) { - auto *ArgC = ConstantFoldLoadThroughBitcast(getVal(*ArgI), *ParI, DL); + for (Type *PTy : FTy->params()) { + auto *ArgC = ConstantFoldLoadThroughBitcast(getVal(*ArgI), PTy, DL); if (!ArgC) { LLVM_DEBUG(dbgs() << "Can not convert function argument.\n"); return false; diff --git a/contrib/llvm-project/llvm/lib/Transforms/Utils/LoopSimplify.cpp b/contrib/llvm-project/llvm/lib/Transforms/Utils/LoopSimplify.cpp index d14c006c8032..67311ab4cd02 100644 --- a/contrib/llvm-project/llvm/lib/Transforms/Utils/LoopSimplify.cpp +++ b/contrib/llvm-project/llvm/lib/Transforms/Utils/LoopSimplify.cpp @@ -293,9 +293,8 @@ static Loop *separateNestedLoop(Loop *L, BasicBlock *Preheader, // L is now a subloop of our outer loop. NewOuter->addChildLoop(L); - for (Loop::block_iterator I = L->block_begin(), E = L->block_end(); - I != E; ++I) - NewOuter->addBlockEntry(*I); + for (BasicBlock *BB : L->blocks()) + NewOuter->addBlockEntry(BB); // Now reset the header in L, which had been moved by // SplitBlockPredecessors for the outer loop. @@ -496,12 +495,12 @@ ReprocessLoop: // predecessors that are not in the loop. This is not valid for natural // loops, but can occur if the blocks are unreachable. Since they are // unreachable we can just shamelessly delete those CFG edges! - for (Loop::block_iterator BB = L->block_begin(), E = L->block_end(); - BB != E; ++BB) { - if (*BB == L->getHeader()) continue; + for (BasicBlock *BB : L->blocks()) { + if (BB == L->getHeader()) + continue; SmallPtrSet<BasicBlock*, 4> BadPreds; - for (BasicBlock *P : predecessors(*BB)) + for (BasicBlock *P : predecessors(BB)) if (!L->contains(P)) BadPreds.insert(P); diff --git a/contrib/llvm-project/llvm/lib/Transforms/Utils/LoopUtils.cpp b/contrib/llvm-project/llvm/lib/Transforms/Utils/LoopUtils.cpp index f0f079335683..68572d479742 100644 --- a/contrib/llvm-project/llvm/lib/Transforms/Utils/LoopUtils.cpp +++ b/contrib/llvm-project/llvm/lib/Transforms/Utils/LoopUtils.cpp @@ -663,9 +663,8 @@ void llvm::deleteDeadLoop(Loop *L, DominatorTree *DT, ScalarEvolution *SE, // about ordering because we already dropped the references. // NOTE: This iteration is safe because erasing the block does not remove // its entry from the loop's block list. We do that in the next section. - for (Loop::block_iterator LpI = L->block_begin(), LpE = L->block_end(); - LpI != LpE; ++LpI) - (*LpI)->eraseFromParent(); + for (BasicBlock *BB : L->blocks()) + BB->eraseFromParent(); // Finally, the blocks from loopinfo. This has to happen late because // otherwise our loop iterators won't work. @@ -1501,10 +1500,9 @@ Loop *llvm::cloneLoop(Loop *L, Loop *PL, ValueToValueMapTy &VM, LPM->addLoop(New); // Add all of the blocks in L to the new loop. - for (Loop::block_iterator I = L->block_begin(), E = L->block_end(); - I != E; ++I) - if (LI->getLoopFor(*I) == L) - New.addBasicBlockToLoop(cast<BasicBlock>(VM[*I]), *LI); + for (BasicBlock *BB : L->blocks()) + if (LI->getLoopFor(BB) == L) + New.addBasicBlockToLoop(cast<BasicBlock>(VM[BB]), *LI); // Add all of the subloops to the new loop. for (Loop *I : *L) diff --git a/contrib/llvm-project/llvm/lib/Transforms/Utils/MetaRenamer.cpp b/contrib/llvm-project/llvm/lib/Transforms/Utils/MetaRenamer.cpp index b1965cf2becb..3ce10535d45f 100644 --- a/contrib/llvm-project/llvm/lib/Transforms/Utils/MetaRenamer.cpp +++ b/contrib/llvm-project/llvm/lib/Transforms/Utils/MetaRenamer.cpp @@ -92,12 +92,12 @@ void MetaRename(Module &M, Renamer renamer(randSeed); // Rename all aliases - for (auto AI = M.alias_begin(), AE = M.alias_end(); AI != AE; ++AI) { - StringRef Name = AI->getName(); + for (GlobalAlias &GA : M.aliases()) { + StringRef Name = GA.getName(); if (Name.startswith("llvm.") || (!Name.empty() && Name[0] == 1)) continue; - AI->setName("alias"); + GA.setName("alias"); } // Rename all global variables diff --git a/contrib/llvm-project/llvm/lib/Transforms/Utils/VNCoercion.cpp b/contrib/llvm-project/llvm/lib/Transforms/Utils/VNCoercion.cpp index dbe3cc93e72b..bbe6b3dc23b3 100644 --- a/contrib/llvm-project/llvm/lib/Transforms/Utils/VNCoercion.cpp +++ b/contrib/llvm-project/llvm/lib/Transforms/Utils/VNCoercion.cpp @@ -201,19 +201,7 @@ static int analyzeLoadFromClobberingWrite(Type *LoadTy, Value *LoadPtr, // (issue a smaller load then merge the bits in) but this seems unlikely to be // valuable. if (StoreOffset > LoadOffset || - StoreOffset + StoreSize < LoadOffset + LoadSize) - return -1; - - // If the load and store are to the exact same address, they should have been - // a must alias. AA must have gotten confused. - // FIXME: Study to see if/when this happens. One case is forwarding a memset - // to a load from the base of the memset. - - // If the load and store don't overlap at all, the store doesn't provide - // anything to the load. In this case, they really don't alias at all, AA - // must have gotten confused. The if statement above ensure the condition - // that StoreOffset <= LoadOffset. - if (StoreOffset + int64_t(StoreSize) <= LoadOffset) + StoreOffset + int64_t(StoreSize) < LoadOffset + int64_t(LoadSize)) return -1; // Okay, we can do this transformation. Return the number of bytes into the |