diff options
Diffstat (limited to 'contrib/llvm-project/llvm/include/llvm')
48 files changed, 504 insertions, 158 deletions
diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/StringRef.h b/contrib/llvm-project/llvm/include/llvm/ADT/StringRef.h index 4e69d5b63354..d892333de391 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/StringRef.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/StringRef.h @@ -258,7 +258,9 @@ namespace llvm { return Length >= Prefix.Length && compareMemory(Data, Prefix.Data, Prefix.Length) == 0; } - [[nodiscard]] bool startswith(StringRef Prefix) const { + [[nodiscard]] LLVM_DEPRECATED( + "Use starts_with instead", + "starts_with") bool startswith(StringRef Prefix) const { return starts_with(Prefix); } @@ -271,7 +273,9 @@ namespace llvm { compareMemory(end() - Suffix.Length, Suffix.Data, Suffix.Length) == 0; } - [[nodiscard]] bool endswith(StringRef Suffix) const { + [[nodiscard]] LLVM_DEPRECATED( + "Use ends_with instead", + "ends_with") bool endswith(StringRef Suffix) const { return ends_with(Suffix); } diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/Twine.h b/contrib/llvm-project/llvm/include/llvm/ADT/Twine.h index 8dfbe4f72e07..1f1fd1967efb 100644 --- a/contrib/llvm-project/llvm/include/llvm/ADT/Twine.h +++ b/contrib/llvm-project/llvm/include/llvm/ADT/Twine.h @@ -37,7 +37,7 @@ namespace llvm { /// A Twine is not intended for use directly and should not be stored, its /// implementation relies on the ability to store pointers to temporary stack /// objects which may be deallocated at the end of a statement. Twines should - /// only be used accepted as const references in arguments, when an API wishes + /// only be used as const references in arguments, when an API wishes /// to accept possibly-concatenated strings. /// /// Twines support a special 'null' value, which always concatenates to form diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/LazyValueInfo.h b/contrib/llvm-project/llvm/include/llvm/Analysis/LazyValueInfo.h index cb5fa35d2995..25a2c9ffa534 100644 --- a/contrib/llvm-project/llvm/include/llvm/Analysis/LazyValueInfo.h +++ b/contrib/llvm-project/llvm/include/llvm/Analysis/LazyValueInfo.h @@ -32,7 +32,6 @@ namespace llvm { friend class LazyValueInfoWrapperPass; AssumptionCache *AC = nullptr; const DataLayout *DL = nullptr; - class TargetLibraryInfo *TLI = nullptr; LazyValueInfoImpl *PImpl = nullptr; LazyValueInfo(const LazyValueInfo &) = delete; void operator=(const LazyValueInfo &) = delete; @@ -43,18 +42,16 @@ namespace llvm { public: ~LazyValueInfo(); LazyValueInfo() = default; - LazyValueInfo(AssumptionCache *AC_, const DataLayout *DL_, - TargetLibraryInfo *TLI_) - : AC(AC_), DL(DL_), TLI(TLI_) {} + LazyValueInfo(AssumptionCache *AC_, const DataLayout *DL_) + : AC(AC_), DL(DL_) {} LazyValueInfo(LazyValueInfo &&Arg) - : AC(Arg.AC), DL(Arg.DL), TLI(Arg.TLI), PImpl(Arg.PImpl) { + : AC(Arg.AC), DL(Arg.DL), PImpl(Arg.PImpl) { Arg.PImpl = nullptr; } LazyValueInfo &operator=(LazyValueInfo &&Arg) { releaseMemory(); AC = Arg.AC; DL = Arg.DL; - TLI = Arg.TLI; PImpl = Arg.PImpl; Arg.PImpl = nullptr; return *this; diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/TargetLibraryInfo.h b/contrib/llvm-project/llvm/include/llvm/Analysis/TargetLibraryInfo.h index 2ffd4d4b7143..daf1d8e2079f 100644 --- a/contrib/llvm-project/llvm/include/llvm/Analysis/TargetLibraryInfo.h +++ b/contrib/llvm-project/llvm/include/llvm/Analysis/TargetLibraryInfo.h @@ -156,6 +156,10 @@ public: /// FDecl is assumed to have a parent Module when using this function. bool getLibFunc(const Function &FDecl, LibFunc &F) const; + /// Searches for a function name using an Instruction \p Opcode. + /// Currently, only the frem instruction is supported. + bool getLibFunc(unsigned int Opcode, Type *Ty, LibFunc &F) const; + /// Forces a function to be marked as unavailable. void setUnavailable(LibFunc F) { setState(F, Unavailable); @@ -360,6 +364,12 @@ public: getLibFunc(*(CB.getCalledFunction()), F); } + /// Searches for a function name using an Instruction \p Opcode. + /// Currently, only the frem instruction is supported. + bool getLibFunc(unsigned int Opcode, Type *Ty, LibFunc &F) const { + return Impl->getLibFunc(Opcode, Ty, F); + } + /// Disables all builtins. /// /// This can be used for options like -fno-builtin. diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/TargetTransformInfo.h b/contrib/llvm-project/llvm/include/llvm/Analysis/TargetTransformInfo.h index f5114fa40c70..735be3680aea 100644 --- a/contrib/llvm-project/llvm/include/llvm/Analysis/TargetTransformInfo.h +++ b/contrib/llvm-project/llvm/include/llvm/Analysis/TargetTransformInfo.h @@ -560,6 +560,10 @@ public: // (set to UINT_MAX to disable). This does not apply in cases where the // loop is being fully unrolled. unsigned MaxCount; + /// Set the maximum upper bound of trip count. Allowing the MaxUpperBound + /// to be overrided by a target gives more flexiblity on certain cases. + /// By default, MaxUpperBound uses UnrollMaxUpperBound which value is 8. + unsigned MaxUpperBound; /// Set the maximum unrolling factor for full unrolling. Like MaxCount, but /// applies even if full unrolling is selected. This allows a target to fall /// back to Partial unrolling if full unrolling is above FullUnrollMaxCount. diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/ValueLattice.h b/contrib/llvm-project/llvm/include/llvm/Analysis/ValueLattice.h index 5ae32b5e775e..2898cdd3d7b0 100644 --- a/contrib/llvm-project/llvm/include/llvm/Analysis/ValueLattice.h +++ b/contrib/llvm-project/llvm/include/llvm/Analysis/ValueLattice.h @@ -202,10 +202,7 @@ public: static ValueLatticeElement get(Constant *C) { ValueLatticeElement Res; - if (isa<UndefValue>(C)) - Res.markUndef(); - else - Res.markConstant(C); + Res.markConstant(C); return Res; } static ValueLatticeElement getNot(Constant *C) { diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/ValueTracking.h b/contrib/llvm-project/llvm/include/llvm/Analysis/ValueTracking.h index a3186e61b94a..baa16306ebf5 100644 --- a/contrib/llvm-project/llvm/include/llvm/Analysis/ValueTracking.h +++ b/contrib/llvm-project/llvm/include/llvm/Analysis/ValueTracking.h @@ -863,6 +863,11 @@ ConstantRange computeConstantRange(const Value *V, bool ForSigned, const DominatorTree *DT = nullptr, unsigned Depth = 0); +/// Combine constant ranges from computeConstantRange() and computeKnownBits(). +ConstantRange +computeConstantRangeIncludingKnownBits(const WithCache<const Value *> &V, + bool ForSigned, const SimplifyQuery &SQ); + /// Return true if this function can prove that the instruction I will /// always transfer execution to one of its successors (including the next /// instruction that follows within a basic block). E.g. this is not diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/VecFuncs.def b/contrib/llvm-project/llvm/include/llvm/Analysis/VecFuncs.def index c628e72b24d1..4bffcdee6f9c 100644 --- a/contrib/llvm-project/llvm/include/llvm/Analysis/VecFuncs.def +++ b/contrib/llvm-project/llvm/include/llvm/Analysis/VecFuncs.def @@ -493,6 +493,7 @@ TLI_DEFINE_VECFUNC( "llvm.exp2.f64", "_ZGVnN2v_exp2", FIXED(2), "_ZGV_LLVM_N2v") TLI_DEFINE_VECFUNC( "exp10", "_ZGVnN2v_exp10", FIXED(2), "_ZGV_LLVM_N2v") TLI_DEFINE_VECFUNC( "llvm.exp10.f64", "_ZGVnN2v_exp10", FIXED(2), "_ZGV_LLVM_N2v") +TLI_DEFINE_VECFUNC("fmod", "_ZGVnN2vv_fmod", FIXED(2), "_ZGV_LLVM_N2vv") TLI_DEFINE_VECFUNC( "lgamma", "_ZGVnN2v_lgamma", FIXED(2), "_ZGV_LLVM_N2v") @@ -546,6 +547,7 @@ TLI_DEFINE_VECFUNC( "llvm.exp2.f32", "_ZGVnN4v_exp2f", FIXED(4), "_ZGV_LLVM_N4v" TLI_DEFINE_VECFUNC( "exp10f", "_ZGVnN4v_exp10f", FIXED(4), "_ZGV_LLVM_N4v") TLI_DEFINE_VECFUNC( "llvm.exp10.f32", "_ZGVnN4v_exp10f", FIXED(4), "_ZGV_LLVM_N4v") +TLI_DEFINE_VECFUNC("fmodf", "_ZGVnN4vv_fmodf", FIXED(4), "_ZGV_LLVM_N4vv") TLI_DEFINE_VECFUNC( "lgammaf", "_ZGVnN4v_lgammaf", FIXED(4), "_ZGV_LLVM_N4v") diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/VectorUtils.h b/contrib/llvm-project/llvm/include/llvm/Analysis/VectorUtils.h index 55a6aa645a86..b1ecc8777c16 100644 --- a/contrib/llvm-project/llvm/include/llvm/Analysis/VectorUtils.h +++ b/contrib/llvm-project/llvm/include/llvm/Analysis/VectorUtils.h @@ -195,6 +195,16 @@ static constexpr char const *MappingsAttrName = "vector-function-abi-variant"; /// the presence of the attribute (see InjectTLIMappings). void getVectorVariantNames(const CallInst &CI, SmallVectorImpl<std::string> &VariantMappings); + +/// Constructs a FunctionType by applying vector function information to the +/// type of a matching scalar function. +/// \param Info gets the vectorization factor (VF) and the VFParamKind of the +/// parameters. +/// \param ScalarFTy gets the Type information of parameters, as it is not +/// stored in \p Info. +/// \returns a pointer to a newly created vector FunctionType +FunctionType *createFunctionType(const VFInfo &Info, + const FunctionType *ScalarFTy); } // end namespace VFABI /// The Vector Function Database. diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/AccelTable.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/AccelTable.h index af874aa5e91a..6eb09f32f9f9 100644 --- a/contrib/llvm-project/llvm/include/llvm/CodeGen/AccelTable.h +++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/AccelTable.h @@ -270,16 +270,14 @@ public: #endif uint64_t getDieOffset() const { - assert(std::holds_alternative<uint64_t>(OffsetVal) && - "Accessing DIE Offset before normalizing."); + assert(isNormalized() && "Accessing DIE Offset before normalizing."); return std::get<uint64_t>(OffsetVal); } unsigned getDieTag() const { return DieTag; } unsigned getUnitID() const { return UnitID; } bool isTU() const { return IsTU; } void normalizeDIEToOffset() { - assert(std::holds_alternative<const DIE *>(OffsetVal) && - "Accessing offset after normalizing."); + assert(!isNormalized() && "Accessing offset after normalizing."); OffsetVal = std::get<const DIE *>(OffsetVal)->getOffset(); } bool isNormalized() const { @@ -309,7 +307,7 @@ class DWARF5AccelTable : public AccelTable<DWARF5AccelTableData> { public: struct UnitIndexAndEncoding { unsigned Index; - DWARF5AccelTableData::AttributeEncoding Endoding; + DWARF5AccelTableData::AttributeEncoding Encoding; }; /// Returns type units that were constructed. const TUVectorTy &getTypeUnitsSymbols() { return TUSymbolsOrHashes; } diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h index ac9e66c4dc2f..06da9fb57902 100644 --- a/contrib/llvm-project/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h +++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h @@ -32,6 +32,7 @@ #include "llvm/CodeGen/InterleavedAccess.h" #include "llvm/CodeGen/InterleavedLoadCombine.h" #include "llvm/CodeGen/JMCInstrumenter.h" +#include "llvm/CodeGen/LowerEmuTLS.h" #include "llvm/CodeGen/MachinePassManager.h" #include "llvm/CodeGen/PreISelIntrinsicLowering.h" #include "llvm/CodeGen/ReplaceWithVeclib.h" @@ -77,13 +78,6 @@ namespace llvm { return PreservedAnalyses::all(); \ } \ }; -#define DUMMY_MODULE_PASS(NAME, PASS_NAME, CONSTRUCTOR) \ - struct PASS_NAME : public PassInfoMixin<PASS_NAME> { \ - template <typename... Ts> PASS_NAME(Ts &&...) {} \ - PreservedAnalyses run(Module &, ModuleAnalysisManager &) { \ - return PreservedAnalyses::all(); \ - } \ - }; #define DUMMY_MACHINE_MODULE_PASS(NAME, PASS_NAME, CONSTRUCTOR) \ struct PASS_NAME : public MachinePassInfoMixin<PASS_NAME> { \ template <typename... Ts> PASS_NAME(Ts &&...) {} \ @@ -701,6 +695,7 @@ void CodeGenPassBuilder<Derived>::addPassesToHandleExceptions( case ExceptionHandling::DwarfCFI: case ExceptionHandling::ARM: case ExceptionHandling::AIX: + case ExceptionHandling::ZOS: addPass(DwarfEHPreparePass(&TM)); break; case ExceptionHandling::WinEH: diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/LowerEmuTLS.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/LowerEmuTLS.h new file mode 100644 index 000000000000..ecd1352a89f4 --- /dev/null +++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/LowerEmuTLS.h @@ -0,0 +1,29 @@ +//==------ llvm/CodeGen/LowerEmuTLS.h -------------------------*- C++ -*----==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +/// \file Add Add __emutls_[vt].* variables. +/// +/// This file provide declaration of LowerEmuTLSPass. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CODEGEN_LOWEREMUTLS_H +#define LLVM_CODEGEN_LOWEREMUTLS_H + +#include "llvm/IR/PassManager.h" + +namespace llvm { + +class LowerEmuTLSPass : public PassInfoMixin<LowerEmuTLSPass> { +public: + PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM); +}; + +} // namespace llvm + +#endif // LLVM_CODEGEN_LOWEREMUTLS_H diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/MachinePassRegistry.def b/contrib/llvm-project/llvm/include/llvm/CodeGen/MachinePassRegistry.def index 04f2cd5ff581..f950dfae7e33 100644 --- a/contrib/llvm-project/llvm/include/llvm/CodeGen/MachinePassRegistry.def +++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/MachinePassRegistry.def @@ -25,6 +25,7 @@ MODULE_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis, (PIC)) #endif MODULE_PASS("pre-isel-intrinsic-lowering", PreISelIntrinsicLoweringPass, ()) MODULE_PASS("jmc-instrumenter", JMCInstrumenterPass, ()) +MODULE_PASS("lower-emutls", LowerEmuTLSPass, ()) #undef MODULE_PASS #ifndef FUNCTION_ANALYSIS @@ -136,12 +137,6 @@ DUMMY_FUNCTION_PASS("shadow-stack-gc-lowering", ShadowStackGCLoweringPass, ()) DUMMY_FUNCTION_PASS("stack-protector", StackProtectorPass, ()) #undef DUMMY_FUNCTION_PASS -#ifndef DUMMY_MODULE_PASS -#define DUMMY_MODULE_PASS(NAME, PASS_NAME, CONSTRUCTOR) -#endif -DUMMY_MODULE_PASS("lower-emutls", LowerEmuTLSPass, ()) -#undef DUMMY_MODULE_PASS - #ifndef DUMMY_MACHINE_MODULE_PASS #define DUMMY_MACHINE_MODULE_PASS(NAME, PASS_NAME, CONSTRUCTOR) #endif diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/MacroFusion.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/MacroFusion.h index a359fca60426..191c906e9ef6 100644 --- a/contrib/llvm-project/llvm/include/llvm/CodeGen/MacroFusion.h +++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/MacroFusion.h @@ -50,15 +50,11 @@ bool fuseInstructionPair(ScheduleDAGInstrs &DAG, SUnit &FirstSU, /// for instructions that benefit according to the target-specific /// predicate functions. shouldScheduleAdjacent will be true if any of the /// provided predicates are true. +/// If BranchOnly is true, only branch instructions with one of their +/// predecessors will be fused. std::unique_ptr<ScheduleDAGMutation> -createMacroFusionDAGMutation(ArrayRef<MacroFusionPredTy> Predicates); - -/// Create a DAG scheduling mutation to pair branch instructions with one -/// of their predecessors back to back for instructions that benefit according -/// to the target-specific predicate functions. shouldScheduleAdjacent will be -/// true if any of the provided predicates are true. -std::unique_ptr<ScheduleDAGMutation> -createBranchMacroFusionDAGMutation(ArrayRef<MacroFusionPredTy> Predicates); +createMacroFusionDAGMutation(ArrayRef<MacroFusionPredTy> Predicates, + bool BranchOnly = false); } // end namespace llvm diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/SelectionDAGISel.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/SelectionDAGISel.h index c604e7eaa088..40046e0a8dec 100644 --- a/contrib/llvm-project/llvm/include/llvm/CodeGen/SelectionDAGISel.h +++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/SelectionDAGISel.h @@ -223,6 +223,8 @@ public: // Space-optimized forms that implicitly encode integer VT. OPC_EmitStringInteger32, OPC_EmitRegister, + OPC_EmitRegisterI32, + OPC_EmitRegisterI64, OPC_EmitRegister2, OPC_EmitConvertToTarget, OPC_EmitConvertToTarget0, diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/TargetLowering.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/TargetLowering.h index 490125164ab3..ed2b513be960 100644 --- a/contrib/llvm-project/llvm/include/llvm/CodeGen/TargetLowering.h +++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/TargetLowering.h @@ -2869,6 +2869,12 @@ public: getApproximateEVTForLLT(ToTy, DL, Ctx)); } + /// Return true if truncating the specific node Val to type VT2 is free. + virtual bool isTruncateFree(SDValue Val, EVT VT2) const { + // Fallback to type matching. + return isTruncateFree(Val.getValueType(), VT2); + } + virtual bool isProfitableToHoist(Instruction *I) const { return true; } /// Return true if the extension represented by \p I is free. diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h index 9f92b919824d..4a7c1ca4a571 100644 --- a/contrib/llvm-project/llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h +++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h @@ -309,6 +309,8 @@ public: const TargetMachine &TM) const override; MCSection *getExplicitSectionGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override; + MCSection *getSectionForLSDA(const Function &F, const MCSymbol &FnSym, + const TargetMachine &TM) const override; }; } // end namespace llvm diff --git a/contrib/llvm-project/llvm/include/llvm/Frontend/HLSL/HLSLResource.h b/contrib/llvm-project/llvm/include/llvm/Frontend/HLSL/HLSLResource.h index eedecaea4e58..068b4c66711e 100644 --- a/contrib/llvm-project/llvm/include/llvm/Frontend/HLSL/HLSLResource.h +++ b/contrib/llvm-project/llvm/include/llvm/Frontend/HLSL/HLSLResource.h @@ -54,6 +54,30 @@ enum class ResourceKind : uint32_t { NumEntries, }; +// The value ordering of this enumeration is part of the DXIL ABI. Elements +// can only be added to the end, and not removed. +enum class ElementType : uint32_t { + Invalid = 0, + I1, + I16, + U16, + I32, + U32, + I64, + U64, + F16, + F32, + F64, + SNormF16, + UNormF16, + SNormF32, + UNormF32, + SNormF64, + UNormF64, + PackedS8x32, + PackedU8x32, +}; + class FrontendResource { MDNode *Entry; @@ -62,12 +86,13 @@ public: assert(Entry->getNumOperands() == 6 && "Unexpected metadata shape"); } - FrontendResource(GlobalVariable *GV, StringRef TypeStr, ResourceKind RK, + FrontendResource(GlobalVariable *GV, ResourceKind RK, ElementType ElTy, bool IsROV, uint32_t ResIndex, uint32_t Space); GlobalVariable *getGlobalVariable(); StringRef getSourceType(); ResourceKind getResourceKind(); + ElementType getElementType(); bool getIsROV(); uint32_t getResourceIndex(); uint32_t getSpace(); diff --git a/contrib/llvm-project/llvm/include/llvm/IR/Constants.h b/contrib/llvm-project/llvm/include/llvm/IR/Constants.h index 0b9f89830b79..b5dcc7fbc1d9 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/Constants.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/Constants.h @@ -171,10 +171,9 @@ public: /// Determine if this constant's value is same as an unsigned char. bool equalsInt(uint64_t V) const { return Val == V; } - /// getType - Specialize the getType() method to always return an IntegerType, - /// which reduces the amount of casting needed in parts of the compiler. - /// - inline IntegerType *getType() const { + /// Variant of the getType() method to always return an IntegerType, which + /// reduces the amount of casting needed in parts of the compiler. + inline IntegerType *getIntegerType() const { return cast<IntegerType>(Value::getType()); } diff --git a/contrib/llvm-project/llvm/include/llvm/IR/DiagnosticHandler.h b/contrib/llvm-project/llvm/include/llvm/IR/DiagnosticHandler.h index 55e5e5975808..db7d7444f75f 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/DiagnosticHandler.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/DiagnosticHandler.h @@ -23,6 +23,7 @@ class DiagnosticInfo; /// which remarks are enabled. struct DiagnosticHandler { void *DiagnosticContext = nullptr; + bool HasErrors = false; DiagnosticHandler(void *DiagContext = nullptr) : DiagnosticContext(DiagContext) {} virtual ~DiagnosticHandler() = default; diff --git a/contrib/llvm-project/llvm/include/llvm/IR/GenericConvergenceVerifierImpl.h b/contrib/llvm-project/llvm/include/llvm/IR/GenericConvergenceVerifierImpl.h index e2ece30b1864..f6eb5066d553 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/GenericConvergenceVerifierImpl.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/GenericConvergenceVerifierImpl.h @@ -29,7 +29,7 @@ #include "llvm/ADT/GenericConvergenceVerifier.h" #include "llvm/ADT/PostOrderIterator.h" #include "llvm/ADT/Twine.h" -#include "llvm/IR/Intrinsics.h" +#include "llvm/IR/IntrinsicInst.h" #define Check(C, ...) \ do { \ @@ -48,17 +48,6 @@ } while (false) namespace llvm { -static bool isConvergenceControlIntrinsic(unsigned IntrinsicID) { - switch (IntrinsicID) { - default: - return false; - case Intrinsic::experimental_convergence_anchor: - case Intrinsic::experimental_convergence_entry: - case Intrinsic::experimental_convergence_loop: - return true; - } -} - template <class ContextT> void GenericConvergenceVerifier<ContextT>::clear() { Tokens.clear(); CI.clear(); diff --git a/contrib/llvm-project/llvm/include/llvm/IR/GlobalValue.h b/contrib/llvm-project/llvm/include/llvm/IR/GlobalValue.h index d1891c157099..e97a7f2b9636 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/GlobalValue.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/GlobalValue.h @@ -41,6 +41,10 @@ namespace Intrinsic { typedef unsigned ID; } // end namespace Intrinsic +// Choose ';' as the delimiter. ':' was used once but it doesn't work well for +// Objective-C functions which commonly have :'s in their names. +inline constexpr char kGlobalIdentifierDelimiter = ';'; + class GlobalValue : public Constant { public: /// An enumeration for the kinds of linkage for global values. diff --git a/contrib/llvm-project/llvm/include/llvm/IR/IntrinsicInst.h b/contrib/llvm-project/llvm/include/llvm/IR/IntrinsicInst.h index 8940bebd2c9a..b8d578d0fee0 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/IntrinsicInst.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/IntrinsicInst.h @@ -1724,6 +1724,30 @@ public: } }; +/// Check if \p ID corresponds to a convergence control intrinsic. +static inline bool isConvergenceControlIntrinsic(unsigned IntrinsicID) { + switch (IntrinsicID) { + default: + return false; + case Intrinsic::experimental_convergence_anchor: + case Intrinsic::experimental_convergence_entry: + case Intrinsic::experimental_convergence_loop: + return true; + } +} + +/// Represents calls to the llvm.experimintal.convergence.* intrinsics. +class ConvergenceControlInst : public IntrinsicInst { +public: + static bool classof(const IntrinsicInst *I) { + return isConvergenceControlIntrinsic(I->getIntrinsicID()); + } + + static bool classof(const Value *V) { + return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V)); + } +}; + } // end namespace llvm #endif // LLVM_IR_INTRINSICINST_H diff --git a/contrib/llvm-project/llvm/include/llvm/IR/IntrinsicsAMDGPU.td b/contrib/llvm-project/llvm/include/llvm/IR/IntrinsicsAMDGPU.td index 51bd9b63c127..cb48f54b13a6 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/IntrinsicsAMDGPU.td +++ b/contrib/llvm-project/llvm/include/llvm/IR/IntrinsicsAMDGPU.td @@ -2353,14 +2353,14 @@ def int_amdgcn_s_get_waveid_in_workgroup : Intrinsic<[llvm_i32_ty], [], [IntrNoMem, IntrHasSideEffects, IntrWillReturn, IntrNoCallback, IntrNoFree]>; -class AMDGPUGlobalAtomicRtn<LLVMType vt> : Intrinsic < +class AMDGPUAtomicRtn<LLVMType vt> : Intrinsic < [vt], [llvm_anyptr_ty, // vaddr vt], // vdata(VGPR) [IntrArgMemOnly, IntrWillReturn, NoCapture<ArgIndex<0>>, IntrNoCallback, IntrNoFree], "", [SDNPMemOperand]>; -def int_amdgcn_global_atomic_csub : AMDGPUGlobalAtomicRtn<llvm_i32_ty>; +def int_amdgcn_global_atomic_csub : AMDGPUAtomicRtn<llvm_i32_ty>; // uint4 llvm.amdgcn.image.bvh.intersect.ray <node_ptr>, <ray_extent>, <ray_origin>, // <ray_dir>, <ray_inv_dir>, <texture_descr> @@ -2486,10 +2486,10 @@ def int_amdgcn_permlanex16_var : ClangBuiltin<"__builtin_amdgcn_permlanex16_var" [IntrNoMem, IntrConvergent, IntrWillReturn, ImmArg<ArgIndex<3>>, ImmArg<ArgIndex<4>>, IntrNoCallback, IntrNoFree]>; -def int_amdgcn_flat_atomic_fmin_num : AMDGPUGlobalAtomicRtn<llvm_anyfloat_ty>; -def int_amdgcn_flat_atomic_fmax_num : AMDGPUGlobalAtomicRtn<llvm_anyfloat_ty>; -def int_amdgcn_global_atomic_fmin_num : AMDGPUGlobalAtomicRtn<llvm_anyfloat_ty>; -def int_amdgcn_global_atomic_fmax_num : AMDGPUGlobalAtomicRtn<llvm_anyfloat_ty>; +def int_amdgcn_flat_atomic_fmin_num : AMDGPUAtomicRtn<llvm_anyfloat_ty>; +def int_amdgcn_flat_atomic_fmax_num : AMDGPUAtomicRtn<llvm_anyfloat_ty>; +def int_amdgcn_global_atomic_fmin_num : AMDGPUAtomicRtn<llvm_anyfloat_ty>; +def int_amdgcn_global_atomic_fmax_num : AMDGPUAtomicRtn<llvm_anyfloat_ty>; //===----------------------------------------------------------------------===// // Deep learning intrinsics. @@ -2692,7 +2692,7 @@ def int_amdgcn_udot8 : // gfx908 intrinsics // ===----------------------------------------------------------------------===// -def int_amdgcn_global_atomic_fadd : AMDGPUGlobalAtomicRtn<llvm_anyfloat_ty>; +def int_amdgcn_global_atomic_fadd : AMDGPUAtomicRtn<llvm_anyfloat_ty>; // llvm.amdgcn.mfma.*.* vdst, srcA, srcB, srcC, cbsz, abid, blgp class AMDGPUMfmaIntrinsic<LLVMType DestTy, LLVMType SrcABTy> : @@ -2728,11 +2728,11 @@ def int_amdgcn_mfma_f32_16x16x8bf16 : AMDGPUMfmaIntrinsic<llvm_v4f32_ty, llvm_v // gfx90a intrinsics // ===----------------------------------------------------------------------===// -def int_amdgcn_global_atomic_fmin : AMDGPUGlobalAtomicRtn<llvm_anyfloat_ty>; -def int_amdgcn_global_atomic_fmax : AMDGPUGlobalAtomicRtn<llvm_anyfloat_ty>; -def int_amdgcn_flat_atomic_fadd : AMDGPUGlobalAtomicRtn<llvm_anyfloat_ty>; -def int_amdgcn_flat_atomic_fmin : AMDGPUGlobalAtomicRtn<llvm_anyfloat_ty>; -def int_amdgcn_flat_atomic_fmax : AMDGPUGlobalAtomicRtn<llvm_anyfloat_ty>; +def int_amdgcn_global_atomic_fmin : AMDGPUAtomicRtn<llvm_anyfloat_ty>; +def int_amdgcn_global_atomic_fmax : AMDGPUAtomicRtn<llvm_anyfloat_ty>; +def int_amdgcn_flat_atomic_fadd : AMDGPUAtomicRtn<llvm_anyfloat_ty>; +def int_amdgcn_flat_atomic_fmin : AMDGPUAtomicRtn<llvm_anyfloat_ty>; +def int_amdgcn_flat_atomic_fmax : AMDGPUAtomicRtn<llvm_anyfloat_ty>; def int_amdgcn_mfma_f32_32x32x4bf16_1k : AMDGPUMfmaIntrinsic<llvm_v32f32_ty, llvm_v4i16_ty>; def int_amdgcn_mfma_f32_16x16x4bf16_1k : AMDGPUMfmaIntrinsic<llvm_v16f32_ty, llvm_v4i16_ty>; @@ -2751,8 +2751,8 @@ def int_amdgcn_mfma_f64_4x4x4f64 : AMDGPUMfmaIntrinsic<llvm_double_ty, ll // ===----------------------------------------------------------------------===// // bf16 atomics use v2i16 argument since there is no bf16 data type in the llvm. -def int_amdgcn_global_atomic_fadd_v2bf16 : AMDGPUGlobalAtomicRtn<llvm_v2i16_ty>; -def int_amdgcn_flat_atomic_fadd_v2bf16 : AMDGPUGlobalAtomicRtn<llvm_v2i16_ty>; +def int_amdgcn_global_atomic_fadd_v2bf16 : AMDGPUAtomicRtn<llvm_v2i16_ty>; +def int_amdgcn_flat_atomic_fadd_v2bf16 : AMDGPUAtomicRtn<llvm_v2i16_ty>; def int_amdgcn_ds_fadd_v2bf16 : DefaultAttrsIntrinsic< [llvm_v2i16_ty], [LLVMQualPointerType<3>, llvm_v2i16_ty], diff --git a/contrib/llvm-project/llvm/include/llvm/IR/IntrinsicsRISCV.td b/contrib/llvm-project/llvm/include/llvm/IR/IntrinsicsRISCV.td index fc830fca392f..a391bc53cdb0 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/IntrinsicsRISCV.td +++ b/contrib/llvm-project/llvm/include/llvm/IR/IntrinsicsRISCV.td @@ -702,7 +702,7 @@ let TargetPrefix = "riscv" in { LLVMMatchType<2>, LLVMMatchType<2>], [ImmArg<ArgIndex<4>>,ImmArg<ArgIndex<6>>, IntrNoMem, IntrHasSideEffects]>, RISCVVIntrinsic { - let VLOperand = 6; + let VLOperand = 5; } // For Saturating binary operations. // The destination vector type is NOT the same as first source vector. diff --git a/contrib/llvm-project/llvm/include/llvm/IR/PatternMatch.h b/contrib/llvm-project/llvm/include/llvm/IR/PatternMatch.h index 096d1688af3f..48afdb867ba6 100644 --- a/contrib/llvm-project/llvm/include/llvm/IR/PatternMatch.h +++ b/contrib/llvm-project/llvm/include/llvm/IR/PatternMatch.h @@ -1656,6 +1656,19 @@ template <typename Op_t> struct PtrToIntSameSize_match { } }; +template <typename Op_t> struct NNegZExt_match { + Op_t Op; + + NNegZExt_match(const Op_t &OpMatch) : Op(OpMatch) {} + + template <typename OpTy> bool match(OpTy *V) { + if (auto *I = dyn_cast<Instruction>(V)) + return I->getOpcode() == Instruction::ZExt && I->hasNonNeg() && + Op.match(I->getOperand(0)); + return false; + } +}; + /// Matches BitCast. template <typename OpTy> inline CastOperator_match<OpTy, Instruction::BitCast> @@ -1708,6 +1721,11 @@ inline CastInst_match<OpTy, Instruction::ZExt> m_ZExt(const OpTy &Op) { } template <typename OpTy> +inline NNegZExt_match<OpTy> m_NNegZExt(const OpTy &Op) { + return NNegZExt_match<OpTy>(Op); +} + +template <typename OpTy> inline match_combine_or<CastInst_match<OpTy, Instruction::ZExt>, OpTy> m_ZExtOrSelf(const OpTy &Op) { return m_CombineOr(m_ZExt(Op), Op); @@ -1719,6 +1737,14 @@ m_SExtOrSelf(const OpTy &Op) { return m_CombineOr(m_SExt(Op), Op); } +/// Match either "sext" or "zext nneg". +template <typename OpTy> +inline match_combine_or<CastInst_match<OpTy, Instruction::SExt>, + NNegZExt_match<OpTy>> +m_SExtLike(const OpTy &Op) { + return m_CombineOr(m_SExt(Op), m_NNegZExt(Op)); +} + template <typename OpTy> inline match_combine_or<CastInst_match<OpTy, Instruction::ZExt>, CastInst_match<OpTy, Instruction::SExt>> diff --git a/contrib/llvm-project/llvm/include/llvm/MC/MCAsmInfo.h b/contrib/llvm-project/llvm/include/llvm/MC/MCAsmInfo.h index a3c9b19e859d..56492368bd98 100644 --- a/contrib/llvm-project/llvm/include/llvm/MC/MCAsmInfo.h +++ b/contrib/llvm-project/llvm/include/llvm/MC/MCAsmInfo.h @@ -799,7 +799,8 @@ public: /// frame information to unwind. bool usesCFIForEH() const { return (ExceptionsType == ExceptionHandling::DwarfCFI || - ExceptionsType == ExceptionHandling::ARM || usesWindowsCFI()); + ExceptionsType == ExceptionHandling::ARM || + ExceptionsType == ExceptionHandling::ZOS || usesWindowsCFI()); } bool usesWindowsCFI() const { diff --git a/contrib/llvm-project/llvm/include/llvm/MC/MCTargetOptions.h b/contrib/llvm-project/llvm/include/llvm/MC/MCTargetOptions.h index afb329eb6f93..e2dd1e0433db 100644 --- a/contrib/llvm-project/llvm/include/llvm/MC/MCTargetOptions.h +++ b/contrib/llvm-project/llvm/include/llvm/MC/MCTargetOptions.h @@ -24,6 +24,8 @@ enum class ExceptionHandling { WinEH, ///< Windows Exception Handling Wasm, ///< WebAssembly Exception Handling AIX, ///< AIX Exception Handling + ZOS, ///< z/OS MVS Exception Handling. Very similar to DwarfCFI, but the PPA1 + ///< is used instead of an .eh_frame section. }; enum class EmitDwarfUnwindType { diff --git a/contrib/llvm-project/llvm/include/llvm/Object/ELFObjectFile.h b/contrib/llvm-project/llvm/include/llvm/Object/ELFObjectFile.h index de418a1782ac..99477644de4d 100644 --- a/contrib/llvm-project/llvm/include/llvm/Object/ELFObjectFile.h +++ b/contrib/llvm-project/llvm/include/llvm/Object/ELFObjectFile.h @@ -64,6 +64,7 @@ class ELFObjectFileBase : public ObjectFile { SubtargetFeatures getLoongArchFeatures() const; StringRef getAMDGPUCPUName() const; + StringRef getNVPTXCPUName() const; protected: ELFObjectFileBase(unsigned int Type, MemoryBufferRef Source); diff --git a/contrib/llvm-project/llvm/include/llvm/Object/Wasm.h b/contrib/llvm-project/llvm/include/llvm/Object/Wasm.h index dfab4c68d18f..6b8edb90e144 100644 --- a/contrib/llvm-project/llvm/include/llvm/Object/Wasm.h +++ b/contrib/llvm-project/llvm/include/llvm/Object/Wasm.h @@ -144,7 +144,6 @@ public: ArrayRef<wasm::WasmGlobal> globals() const { return Globals; } ArrayRef<wasm::WasmTag> tags() const { return Tags; } ArrayRef<wasm::WasmExport> exports() const { return Exports; } - ArrayRef<WasmSymbol> syms() const { return Symbols; } const wasm::WasmLinkingData &linkingData() const { return LinkingData; } uint32_t getNumberOfSymbols() const { return Symbols.size(); } ArrayRef<wasm::WasmElemSegment> elements() const { return ElemSegments; } diff --git a/contrib/llvm-project/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h b/contrib/llvm-project/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h index 493689f6a61e..2757b8cd54a6 100644 --- a/contrib/llvm-project/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h +++ b/contrib/llvm-project/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h @@ -447,7 +447,7 @@ public: bool isConditionIndependencePairCovered(unsigned Condition) const { auto It = PosToID.find(Condition); if (It != PosToID.end()) - return (IndependencePairs.find(It->second) != IndependencePairs.end()); + return IndependencePairs.contains(It->second); llvm_unreachable("Condition ID without an Ordinal mapping"); } diff --git a/contrib/llvm-project/llvm/include/llvm/ProfileData/InstrProf.h b/contrib/llvm-project/llvm/include/llvm/ProfileData/InstrProf.h index 288dc71d756a..36be2e7d869e 100644 --- a/contrib/llvm-project/llvm/include/llvm/ProfileData/InstrProf.h +++ b/contrib/llvm-project/llvm/include/llvm/ProfileData/InstrProf.h @@ -171,6 +171,8 @@ inline StringRef getInstrProfCounterBiasVarName() { /// Return the marker used to separate PGO names during serialization. inline StringRef getInstrProfNameSeparator() { return "\01"; } +/// Please use getIRPGOFuncName for LLVM IR instrumentation. This function is +/// for front-end (Clang, etc) instrumentation. /// Return the modified name for function \c F suitable to be /// used the key for profile lookup. Variable \c InLTO indicates if this /// is called in LTO optimization passes. @@ -196,20 +198,22 @@ std::string getIRPGOFuncName(const Function &F, bool InLTO = false); std::pair<StringRef, StringRef> getParsedIRPGOFuncName(StringRef IRPGOFuncName); /// Return the name of the global variable used to store a function -/// name in PGO instrumentation. \c FuncName is the name of the function -/// returned by the \c getPGOFuncName call. +/// name in PGO instrumentation. \c FuncName is the IRPGO function name +/// (returned by \c getIRPGOFuncName) for LLVM IR instrumentation and PGO +/// function name (returned by \c getPGOFuncName) for front-end instrumentation. std::string getPGOFuncNameVarName(StringRef FuncName, GlobalValue::LinkageTypes Linkage); /// Create and return the global variable for function name used in PGO -/// instrumentation. \c FuncName is the name of the function returned -/// by \c getPGOFuncName call. +/// instrumentation. \c FuncName is the IRPGO function name (returned by +/// \c getIRPGOFuncName) for LLVM IR instrumentation and PGO function name +/// (returned by \c getPGOFuncName) for front-end instrumentation. GlobalVariable *createPGOFuncNameVar(Function &F, StringRef PGOFuncName); /// Create and return the global variable for function name used in PGO -/// instrumentation. /// \c FuncName is the name of the function -/// returned by \c getPGOFuncName call, \c M is the owning module, -/// and \c Linkage is the linkage of the instrumented function. +/// instrumentation. \c FuncName is the IRPGO function name (returned by +/// \c getIRPGOFuncName) for LLVM IR instrumentation and PGO function name +/// (returned by \c getPGOFuncName) for front-end instrumentation. GlobalVariable *createPGOFuncNameVar(Module &M, GlobalValue::LinkageTypes Linkage, StringRef PGOFuncName); @@ -417,11 +421,11 @@ uint64_t ComputeHash(StringRef K); } // end namespace IndexedInstrProf -/// A symbol table used for function PGO name look-up with keys +/// A symbol table used for function [IR]PGO name look-up with keys /// (such as pointers, md5hash values) to the function. A function's -/// PGO name or name's md5hash are used in retrieving the profile -/// data of the function. See \c getPGOFuncName() method for details -/// on how PGO name is formed. +/// [IR]PGO name or name's md5hash are used in retrieving the profile +/// data of the function. See \c getIRPGOFuncName() and \c getPGOFuncName +/// methods for details how [IR]PGO name is formed. class InstrProfSymtab { public: using AddrHashMap = std::vector<std::pair<uint64_t, uint64_t>>; diff --git a/contrib/llvm-project/llvm/include/llvm/ProfileData/RawMemProfReader.h b/contrib/llvm-project/llvm/include/llvm/ProfileData/RawMemProfReader.h index 796183aacc72..6aa5caec65f7 100644 --- a/contrib/llvm-project/llvm/include/llvm/ProfileData/RawMemProfReader.h +++ b/contrib/llvm-project/llvm/include/llvm/ProfileData/RawMemProfReader.h @@ -147,14 +147,14 @@ public: llvm::SmallVectorImpl<SegmentEntry> &Seg, llvm::MapVector<uint64_t, MemInfoBlock> &Prof, CallStackMap &SM, bool KeepName = false) - : Symbolizer(std::move(Sym)), SegmentInfo(Seg.begin(), Seg.end()), - CallstackProfileData(Prof), StackMap(SM), KeepSymbolName(KeepName) { + : SegmentInfo(Seg.begin(), Seg.end()), CallstackProfileData(Prof), + StackMap(SM), KeepSymbolName(KeepName) { // We don't call initialize here since there is no raw profile to read. The // test should pass in the raw profile as structured data. // If there is an error here then the mock symbolizer has not been // initialized properly. - if (Error E = symbolizeAndFilterStackFrames()) + if (Error E = symbolizeAndFilterStackFrames(std::move(Sym))) report_fatal_error(std::move(E)); if (Error E = mapRawProfileToRecords()) report_fatal_error(std::move(E)); @@ -173,7 +173,8 @@ private: // callstacks from the raw profile. Also prune callstack frames which we can't // symbolize or those that belong to the runtime. For profile entries where // the entire callstack is pruned, we drop the entry from the profile. - Error symbolizeAndFilterStackFrames(); + Error symbolizeAndFilterStackFrames( + std::unique_ptr<llvm::symbolize::SymbolizableModule> Symbolizer); // Construct memprof records for each function and store it in the // `FunctionProfileData` map. A function may have allocation profile data or // callsite data or both. @@ -183,8 +184,6 @@ private: // The profiled binary. object::OwningBinary<object::Binary> Binary; - // A symbolizer to translate virtual addresses to code locations. - std::unique_ptr<llvm::symbolize::SymbolizableModule> Symbolizer; // The preferred load address of the executable segment. uint64_t PreferredTextSegmentAddress = 0; // The base address of the text segment in the process during profiling. diff --git a/contrib/llvm-project/llvm/include/llvm/ProfileData/SampleProf.h b/contrib/llvm-project/llvm/include/llvm/ProfileData/SampleProf.h index d995cc69af89..66aaf602d0e1 100644 --- a/contrib/llvm-project/llvm/include/llvm/ProfileData/SampleProf.h +++ b/contrib/llvm-project/llvm/include/llvm/ProfileData/SampleProf.h @@ -883,7 +883,7 @@ public: /// Returns the call target map collected at a given location. /// Each location is specified by \p LineOffset and \p Discriminator. /// If the location is not found in profile, return error. - ErrorOr<SampleRecord::CallTargetMap> + ErrorOr<const SampleRecord::CallTargetMap &> findCallTargetMapAt(uint32_t LineOffset, uint32_t Discriminator) const { const auto &ret = BodySamples.find( mapIRLocToProfileLoc(LineLocation(LineOffset, Discriminator))); @@ -894,7 +894,7 @@ public: /// Returns the call target map collected at a given location specified by \p /// CallSite. If the location is not found in profile, return error. - ErrorOr<SampleRecord::CallTargetMap> + ErrorOr<const SampleRecord::CallTargetMap &> findCallTargetMapAt(const LineLocation &CallSite) const { const auto &Ret = BodySamples.find(mapIRLocToProfileLoc(CallSite)); if (Ret == BodySamples.end()) diff --git a/contrib/llvm-project/llvm/include/llvm/Support/CommandLine.h b/contrib/llvm-project/llvm/include/llvm/Support/CommandLine.h index 58ef176551b6..8929f9b1db15 100644 --- a/contrib/llvm-project/llvm/include/llvm/Support/CommandLine.h +++ b/contrib/llvm-project/llvm/include/llvm/Support/CommandLine.h @@ -243,6 +243,15 @@ extern ManagedStatic<SubCommand> TopLevelSubCommand; // A special subcommand that can be used to put an option into all subcommands. extern ManagedStatic<SubCommand> AllSubCommands; +class SubCommandGroup { + SmallVector<SubCommand *, 4> Subs; + +public: + SubCommandGroup(std::initializer_list<SubCommand *> IL) : Subs(IL) {} + + ArrayRef<SubCommand *> getSubCommands() const { return Subs; } +}; + //===----------------------------------------------------------------------===// // class Option { @@ -314,10 +323,6 @@ public: return getNumOccurrencesFlag() == cl::ConsumeAfter; } - bool isInAllSubCommands() const { - return Subs.contains(&SubCommand::getAll()); - } - //-------------------------------------------------------------------------=== // Accessor functions set by OptionModifiers // @@ -477,11 +482,19 @@ struct cat { // Specify the subcommand that this option belongs to. struct sub { - SubCommand ⋐ + SubCommand *Sub = nullptr; + SubCommandGroup *Group = nullptr; - sub(SubCommand &S) : Sub(S) {} + sub(SubCommand &S) : Sub(&S) {} + sub(SubCommandGroup &G) : Group(&G) {} - template <class Opt> void apply(Opt &O) const { O.addSubCommand(Sub); } + template <class Opt> void apply(Opt &O) const { + if (Sub) + O.addSubCommand(*Sub); + else if (Group) + for (SubCommand *SC : Group->getSubCommands()) + O.addSubCommand(*SC); + } }; // Specify a callback function to be called when an option is seen. diff --git a/contrib/llvm-project/llvm/include/llvm/Support/YAMLTraits.h b/contrib/llvm-project/llvm/include/llvm/Support/YAMLTraits.h index 99074105a556..3b1f4bad57fc 100644 --- a/contrib/llvm-project/llvm/include/llvm/Support/YAMLTraits.h +++ b/contrib/llvm-project/llvm/include/llvm/Support/YAMLTraits.h @@ -1058,6 +1058,19 @@ yamlize(IO &io, T &Val, bool, EmptyContext &Ctx) { } } +namespace detail { + +template <typename T, typename Context> +std::string doValidate(IO &io, T &Val, Context &Ctx) { + return MappingContextTraits<T, Context>::validate(io, Val, Ctx); +} + +template <typename T> std::string doValidate(IO &io, T &Val, EmptyContext &) { + return MappingTraits<T>::validate(io, Val); +} + +} // namespace detail + template <typename T, typename Context> std::enable_if_t<validatedMappingTraits<T, Context>::value, void> yamlize(IO &io, T &Val, bool, Context &Ctx) { @@ -1066,7 +1079,7 @@ yamlize(IO &io, T &Val, bool, Context &Ctx) { else io.beginMapping(); if (io.outputting()) { - std::string Err = MappingTraits<T>::validate(io, Val); + std::string Err = detail::doValidate(io, Val, Ctx); if (!Err.empty()) { errs() << Err << "\n"; assert(Err.empty() && "invalid struct trying to be written as yaml"); @@ -1074,7 +1087,7 @@ yamlize(IO &io, T &Val, bool, Context &Ctx) { } detail::doMapping(io, Val, Ctx); if (!io.outputting()) { - std::string Err = MappingTraits<T>::validate(io, Val); + std::string Err = detail::doValidate(io, Val, Ctx); if (!Err.empty()) io.setError(Err); } diff --git a/contrib/llvm-project/llvm/include/llvm/Support/raw_ostream.h b/contrib/llvm-project/llvm/include/llvm/Support/raw_ostream.h index 7c8d264afeff..42663a9adf2e 100644 --- a/contrib/llvm-project/llvm/include/llvm/Support/raw_ostream.h +++ b/contrib/llvm-project/llvm/include/llvm/Support/raw_ostream.h @@ -16,7 +16,6 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/DataTypes.h" -#include "llvm/Support/Threading.h" #include <cassert> #include <cstddef> #include <cstdint> @@ -634,54 +633,6 @@ public: }; //===----------------------------------------------------------------------===// -// Socket Streams -//===----------------------------------------------------------------------===// - -/// A raw stream for sockets reading/writing - -class raw_socket_stream; - -// Make sure that calls to WSAStartup and WSACleanup are balanced. -#ifdef _WIN32 -class WSABalancer { -public: - WSABalancer(); - ~WSABalancer(); -}; -#endif // _WIN32 - -class ListeningSocket { - int FD; - std::string SocketPath; - ListeningSocket(int SocketFD, StringRef SocketPath); -#ifdef _WIN32 - WSABalancer _; -#endif // _WIN32 - -public: - static Expected<ListeningSocket> createUnix( - StringRef SocketPath, - int MaxBacklog = llvm::hardware_concurrency().compute_thread_count()); - Expected<std::unique_ptr<raw_socket_stream>> accept(); - ListeningSocket(ListeningSocket &&LS); - ~ListeningSocket(); -}; -class raw_socket_stream : public raw_fd_stream { - uint64_t current_pos() const override { return 0; } -#ifdef _WIN32 - WSABalancer _; -#endif // _WIN32 - -public: - raw_socket_stream(int SocketFD); - /// Create a \p raw_socket_stream connected to the Unix domain socket at \p - /// SocketPath. - static Expected<std::unique_ptr<raw_socket_stream>> - createConnectedUnix(StringRef SocketPath); - ~raw_socket_stream(); -}; - -//===----------------------------------------------------------------------===// // Output Stream Adaptors //===----------------------------------------------------------------------===// diff --git a/contrib/llvm-project/llvm/include/llvm/Support/raw_socket_stream.h b/contrib/llvm-project/llvm/include/llvm/Support/raw_socket_stream.h new file mode 100644 index 000000000000..c219792d8246 --- /dev/null +++ b/contrib/llvm-project/llvm/include/llvm/Support/raw_socket_stream.h @@ -0,0 +1,66 @@ +//===-- llvm/Support/raw_socket_stream.h - Socket streams --*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file contains raw_ostream implementations for streams to communicate +// via UNIX sockets +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_SUPPORT_RAW_SOCKET_STREAM_H +#define LLVM_SUPPORT_RAW_SOCKET_STREAM_H + +#include "llvm/Support/Threading.h" +#include "llvm/Support/raw_ostream.h" + +namespace llvm { + +class raw_socket_stream; + +// Make sure that calls to WSAStartup and WSACleanup are balanced. +#ifdef _WIN32 +class WSABalancer { +public: + WSABalancer(); + ~WSABalancer(); +}; +#endif // _WIN32 + +class ListeningSocket { + int FD; + std::string SocketPath; + ListeningSocket(int SocketFD, StringRef SocketPath); +#ifdef _WIN32 + WSABalancer _; +#endif // _WIN32 + +public: + static Expected<ListeningSocket> createUnix( + StringRef SocketPath, + int MaxBacklog = llvm::hardware_concurrency().compute_thread_count()); + Expected<std::unique_ptr<raw_socket_stream>> accept(); + ListeningSocket(ListeningSocket &&LS); + ~ListeningSocket(); +}; +class raw_socket_stream : public raw_fd_stream { + uint64_t current_pos() const override { return 0; } +#ifdef _WIN32 + WSABalancer _; +#endif // _WIN32 + +public: + raw_socket_stream(int SocketFD); + /// Create a \p raw_socket_stream connected to the Unix domain socket at \p + /// SocketPath. + static Expected<std::unique_ptr<raw_socket_stream>> + createConnectedUnix(StringRef SocketPath); + ~raw_socket_stream(); +}; + +} // end namespace llvm + +#endif diff --git a/contrib/llvm-project/llvm/include/llvm/TargetParser/AArch64TargetParser.h b/contrib/llvm-project/llvm/include/llvm/TargetParser/AArch64TargetParser.h index 56c32fae712c..53dc2be825f2 100644 --- a/contrib/llvm-project/llvm/include/llvm/TargetParser/AArch64TargetParser.h +++ b/contrib/llvm-project/llvm/include/llvm/TargetParser/AArch64TargetParser.h @@ -173,6 +173,9 @@ enum ArchExtKind : unsigned { AEK_SMEF8F16 = 69, // FEAT_SME_F8F16 AEK_SMEF8F32 = 70, // FEAT_SME_F8F32 AEK_SMEFA64 = 71, // FEAT_SME_FA64 + AEK_CPA = 72, // FEAT_CPA + AEK_PAUTHLR = 73, // FEAT_PAuth_LR + AEK_TLBIW = 74, // FEAT_TLBIW AEK_NUM_EXTENSIONS }; using ExtensionBitset = Bitset<AEK_NUM_EXTENSIONS>; @@ -295,6 +298,9 @@ inline constexpr ExtensionInfo Extensions[] = { {"sme-f8f16", AArch64::AEK_SMEF8F16, "+sme-f8f16", "-sme-f8f16", FEAT_INIT, "+sme2,+fp8", 0}, {"sme-f8f32", AArch64::AEK_SMEF8F32, "+sme-f8f32", "-sme-f8f32", FEAT_INIT, "+sme2,+fp8", 0}, {"sme-fa64", AArch64::AEK_SMEFA64, "+sme-fa64", "-sme-fa64", FEAT_INIT, "", 0}, + {"cpa", AArch64::AEK_CPA, "+cpa", "-cpa", FEAT_INIT, "", 0}, + {"pauth-lr", AArch64::AEK_PAUTHLR, "+pauth-lr", "-pauth-lr", FEAT_INIT, "", 0}, + {"tlbiw", AArch64::AEK_TLBIW, "+tlbiw", "-tlbiw", FEAT_INIT, "", 0}, // Special cases {"none", AArch64::AEK_NONE, {}, {}, FEAT_INIT, "", ExtensionInfo::MaxFMVPriority}, }; @@ -378,7 +384,8 @@ inline constexpr ArchInfo ARMV9_3A = { VersionTuple{9, 3}, AProfile, "armv9.3-a AArch64::ExtensionBitset({AArch64::AEK_MOPS, AArch64::AEK_HBC}))}; inline constexpr ArchInfo ARMV9_4A = { VersionTuple{9, 4}, AProfile, "armv9.4-a", "+v9.4a", (ARMV9_3A.DefaultExts | AArch64::ExtensionBitset({AArch64::AEK_SPECRES2, AArch64::AEK_CSSC, AArch64::AEK_RASv2}))}; -inline constexpr ArchInfo ARMV9_5A = { VersionTuple{9, 5}, AProfile, "armv9.5-a", "+v9.5a", (ARMV9_4A.DefaultExts)}; +inline constexpr ArchInfo ARMV9_5A = { VersionTuple{9, 5}, AProfile, "armv9.5-a", "+v9.5a", (ARMV9_4A.DefaultExts | + AArch64::ExtensionBitset({AArch64::AEK_CPA}))}; // For v8-R, we do not enable crypto and align with GCC that enables a more minimal set of optional architecture extensions. inline constexpr ArchInfo ARMV8R = { VersionTuple{8, 0}, RProfile, "armv8-r", "+v8r", (ARMV8_5A.DefaultExts | AArch64::ExtensionBitset({AArch64::AEK_SSBS, diff --git a/contrib/llvm-project/llvm/include/llvm/TargetParser/ARMTargetParserCommon.h b/contrib/llvm-project/llvm/include/llvm/TargetParser/ARMTargetParserCommon.h index e3d9ffc1d4db..1e4187c6fb11 100644 --- a/contrib/llvm-project/llvm/include/llvm/TargetParser/ARMTargetParserCommon.h +++ b/contrib/llvm-project/llvm/include/llvm/TargetParser/ARMTargetParserCommon.h @@ -41,6 +41,7 @@ struct ParsedBranchProtection { StringRef Scope; StringRef Key; bool BranchTargetEnforcement; + bool BranchProtectionPAuthLR; }; bool parseBranchProtection(StringRef Spec, ParsedBranchProtection &PBP, diff --git a/contrib/llvm-project/llvm/include/llvm/TextAPI/DylibReader.h b/contrib/llvm-project/llvm/include/llvm/TextAPI/DylibReader.h new file mode 100644 index 000000000000..b556fbf6832a --- /dev/null +++ b/contrib/llvm-project/llvm/include/llvm/TextAPI/DylibReader.h @@ -0,0 +1,48 @@ +//===- TextAPI/DylibReader.h - TAPI MachO Dylib Reader ----------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +/// +/// Defines the MachO Dynamic Library Reader. +/// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_TEXTAPI_DYLIBREADER_H +#define LLVM_TEXTAPI_DYLIBREADER_H + +#include "llvm/Support/Error.h" +#include "llvm/Support/MemoryBuffer.h" +#include "llvm/TextAPI/ArchitectureSet.h" +#include "llvm/TextAPI/RecordsSlice.h" + +namespace llvm::MachO::DylibReader { + +struct ParseOption { + /// Determines arch slice to parse. + ArchitectureSet Archs = ArchitectureSet::All(); + /// Capture Mach-O header from binary, primarily load commands. + bool MachOHeader = true; + /// Capture defined symbols out of export trie and n-list. + bool SymbolTable = true; + /// Capture undefined symbols too. + bool Undefineds = true; +}; + +/// Parse Mach-O dynamic libraries to extract TAPI attributes. +/// +/// \param Buffer Data that points to dylib. +/// \param Options Determines which attributes to extract. +/// \return List of record slices. +Expected<Records> readFile(MemoryBufferRef Buffer, const ParseOption &Opt); + +/// Get TAPI file representation of binary dylib. +/// +/// \param Buffer Data that points to dylib. +Expected<std::unique_ptr<InterfaceFile>> get(MemoryBufferRef Buffer); + +} // namespace llvm::MachO::DylibReader + +#endif // LLVM_TEXTAPI_DYLIBREADER_H diff --git a/contrib/llvm-project/llvm/include/llvm/TextAPI/Record.h b/contrib/llvm-project/llvm/include/llvm/TextAPI/Record.h index 3b62af49902b..4bb1be9d0ad4 100644 --- a/contrib/llvm-project/llvm/include/llvm/TextAPI/Record.h +++ b/contrib/llvm-project/llvm/include/llvm/TextAPI/Record.h @@ -14,6 +14,7 @@ #ifndef LLVM_TEXTAPI_RECORD_H #define LLVM_TEXTAPI_RECORD_H +#include "llvm/ADT/MapVector.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Casting.h" #include "llvm/TextAPI/Symbol.h" @@ -50,7 +51,7 @@ class Record { public: Record() = default; Record(StringRef Name, RecordLinkage Linkage, SymbolFlags Flags) - : Name(Name), Linkage(Linkage), Flags(Flags) {} + : Name(Name), Linkage(Linkage), Flags(mergeFlags(Flags, Linkage)) {} bool isWeakDefined() const { return (Flags & SymbolFlags::WeakDefined) == SymbolFlags::WeakDefined; @@ -79,6 +80,10 @@ public: bool isRexported() const { return Linkage == RecordLinkage::Rexported; } StringRef getName() const { return Name; } + SymbolFlags getFlags() const { return Flags; } + +private: + SymbolFlags mergeFlags(SymbolFlags Flags, RecordLinkage Linkage); protected: StringRef Name; @@ -103,6 +108,10 @@ public: bool isFunction() const { return GV == Kind::Function; } bool isVariable() const { return GV == Kind::Variable; } + void setKind(const Kind &V) { + if (GV == Kind::Unknown) + GV = V; + } private: Kind GV; @@ -133,6 +142,7 @@ public: ObjCIVarRecord *addObjCIVar(StringRef IVar, RecordLinkage Linkage); ObjCIVarRecord *findObjCIVar(StringRef IVar) const; + std::vector<ObjCIVarRecord *> getObjCIVars() const; private: RecordMap<ObjCIVarRecord> IVars; @@ -159,6 +169,7 @@ public: bool hasExceptionAttribute() const { return HasEHType; } bool addObjCCategory(ObjCCategoryRecord *Record); + std::vector<ObjCCategoryRecord *> getObjCCategories() const; private: bool HasEHType; diff --git a/contrib/llvm-project/llvm/include/llvm/TextAPI/RecordVisitor.h b/contrib/llvm-project/llvm/include/llvm/TextAPI/RecordVisitor.h new file mode 100644 index 000000000000..34e43f5b0027 --- /dev/null +++ b/contrib/llvm-project/llvm/include/llvm/TextAPI/RecordVisitor.h @@ -0,0 +1,54 @@ +//===- llvm/TextAPI/RecordSlice.h - TAPI RecordSlice ------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +/// +/// Defines the TAPI Record Visitor. +/// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_TEXTAPI_RECORDVISITOR_H +#define LLVM_TEXTAPI_RECORDVISITOR_H + +#include "llvm/TextAPI/Record.h" +#include "llvm/TextAPI/SymbolSet.h" + +namespace llvm { +namespace MachO { + +/// Base class for any usage of traversing over collected Records. +class RecordVisitor { +public: + virtual ~RecordVisitor(); + + virtual void visitGlobal(const GlobalRecord &) = 0; + virtual void visitObjCInterface(const ObjCInterfaceRecord &); + virtual void visitObjCCategory(const ObjCCategoryRecord &); +}; + +/// Specialized RecordVisitor for collecting exported symbols +/// and undefined symbols if RecordSlice being visited represents a +/// flat-namespaced library. +class SymbolConverter : public RecordVisitor { +public: + SymbolConverter(SymbolSet *Symbols, const Target &T, + const bool RecordUndefs = false) + : Symbols(Symbols), Targ(T), RecordUndefs(RecordUndefs) {} + void visitGlobal(const GlobalRecord &) override; + void visitObjCInterface(const ObjCInterfaceRecord &) override; + void visitObjCCategory(const ObjCCategoryRecord &) override; + +private: + void addIVars(const ArrayRef<ObjCIVarRecord *>, StringRef ContainerName); + SymbolSet *Symbols; + const Target Targ; + const bool RecordUndefs; +}; + +} // end namespace MachO. +} // end namespace llvm. + +#endif // LLVM_TEXTAPI_RECORDVISITOR_H diff --git a/contrib/llvm-project/llvm/include/llvm/TextAPI/RecordsSlice.h b/contrib/llvm-project/llvm/include/llvm/TextAPI/RecordsSlice.h index 8d733fd797ec..0f9e3fad1a30 100644 --- a/contrib/llvm-project/llvm/include/llvm/TextAPI/RecordsSlice.h +++ b/contrib/llvm-project/llvm/include/llvm/TextAPI/RecordsSlice.h @@ -14,11 +14,11 @@ #ifndef LLVM_TEXTAPI_RECORDSLICE_H #define LLVM_TEXTAPI_RECORDSLICE_H -#include "llvm/ADT/MapVector.h" #include "llvm/Support/Allocator.h" #include "llvm/TextAPI/InterfaceFile.h" #include "llvm/TextAPI/PackedVersion.h" #include "llvm/TextAPI/Record.h" +#include "llvm/TextAPI/RecordVisitor.h" namespace llvm { namespace MachO { @@ -133,6 +133,9 @@ public: Categories.empty(); } + // Visit all records known to RecordsSlice. + void visit(RecordVisitor &V) const; + struct BinaryAttrs { std::vector<StringRef> AllowableClients; std::vector<StringRef> RexportedLibraries; @@ -174,6 +177,12 @@ private: R->Linkage = std::max(R->Linkage, L); } + /// Update set flags of requested record. + /// + /// \param R The global record to update. + /// \param F Flags to update to. + void updateFlags(GlobalRecord *R, SymbolFlags F) { R->Flags = F; } + RecordMap<GlobalRecord> Globals; RecordMap<ObjCInterfaceRecord> Classes; RecordMap<ObjCCategoryRecord, std::pair<StringRef, StringRef>> Categories; @@ -181,6 +190,9 @@ private: std::unique_ptr<BinaryAttrs> BA{nullptr}; }; +using Records = llvm::SmallVector<std::shared_ptr<RecordsSlice>, 4>; +std::unique_ptr<InterfaceFile> convertToInterfaceFile(const Records &Slices); + } // namespace MachO } // namespace llvm #endif // LLVM_TEXTAPI_RECORDSLICE_H diff --git a/contrib/llvm-project/llvm/include/llvm/TextAPI/TextAPIError.h b/contrib/llvm-project/llvm/include/llvm/TextAPI/TextAPIError.h index de19f7894d35..f0578654697b 100644 --- a/contrib/llvm-project/llvm/include/llvm/TextAPI/TextAPIError.h +++ b/contrib/llvm-project/llvm/include/llvm/TextAPI/TextAPIError.h @@ -21,7 +21,8 @@ enum class TextAPIErrorCode { NoSuchArchitecture, EmptyResults, GenericFrontendError, - InvalidInputFormat + InvalidInputFormat, + UnsupportedTarget }; class TextAPIError : public llvm::ErrorInfo<TextAPIError> { diff --git a/contrib/llvm-project/llvm/include/llvm/TextAPI/Utils.h b/contrib/llvm-project/llvm/include/llvm/TextAPI/Utils.h new file mode 100644 index 000000000000..bb22ea5e9606 --- /dev/null +++ b/contrib/llvm-project/llvm/include/llvm/TextAPI/Utils.h @@ -0,0 +1,34 @@ +//===- llvm/TextAPI/Utils.h - TAPI Utils -----------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Helper functionality used for Darwin specific operations. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_TEXTAPI_UTILS_H +#define LLVM_TEXTAPI_UTILS_H + +#include "llvm/ADT/Twine.h" +#include "llvm/Support/FileSystem.h" +#include "llvm/Support/Path.h" + +#if !defined(PATH_MAX) +#define PATH_MAX 1024 +#endif + +namespace llvm::MachO { + +using PathSeq = std::vector<std::string>; + +/// Replace extension considering frameworks. +/// +/// \param Path Location of file. +/// \param Extension File extension to update with. +void replace_extension(SmallVectorImpl<char> &Path, const Twine &Extension); +} // namespace llvm::MachO +#endif // LLVM_TEXTAPI_UTILS_H diff --git a/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/Attributor.h b/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/Attributor.h index 50167708163e..30c51250af61 100644 --- a/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/Attributor.h +++ b/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/Attributor.h @@ -1157,6 +1157,12 @@ struct AnalysisGetter { return nullptr; } + /// Invalidates the analyses. Valid only when using the new pass manager. + void invalidateAnalyses() { + assert(FAM && "Can only be used from the new PM!"); + FAM->clear(); + } + AnalysisGetter(FunctionAnalysisManager &FAM, bool CachedOnly = false) : FAM(&FAM), CachedOnly(CachedOnly) {} AnalysisGetter(Pass *P, bool CachedOnly = false) @@ -1286,6 +1292,10 @@ struct InformationCache { return AssumeOnlyValues.contains(&I); } + /// Invalidates the cached analyses. Valid only when using the new pass + /// manager. + void invalidateAnalyses() { AG.invalidateAnalyses(); } + /// Return the analysis result from a pass \p AP for function \p F. template <typename AP> typename AP::Result *getAnalysisResultForFunction(const Function &F, diff --git a/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h b/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h index 9a0abdfa8954..8bf902fc8d28 100644 --- a/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h +++ b/contrib/llvm-project/llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h @@ -114,9 +114,8 @@ public: uint64_t CallsiteCount = 0; LineLocation Callsite = Callee->getCallSiteLoc(); if (auto CallTargets = CallerSamples->findCallTargetMapAt(Callsite)) { - SampleRecord::CallTargetMap &TargetCounts = CallTargets.get(); - auto It = TargetCounts.find(CalleeSamples->getFunction()); - if (It != TargetCounts.end()) + auto It = CallTargets->find(CalleeSamples->getFunction()); + if (It != CallTargets->end()) CallsiteCount = It->second; } Weight = std::max(CallsiteCount, CalleeEntryCount); |