LLVM  14.0.0git
ModuleSummaryIndex.h
Go to the documentation of this file.
1 //===- llvm/ModuleSummaryIndex.h - Module Summary Index ---------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 /// @file
10 /// ModuleSummaryIndex.h This file contains the declarations the classes that
11 /// hold the module index and summary for function importing.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_IR_MODULESUMMARYINDEX_H
16 #define LLVM_IR_MODULESUMMARYINDEX_H
17 
18 #include "llvm/ADT/ArrayRef.h"
19 #include "llvm/ADT/DenseMap.h"
20 #include "llvm/ADT/STLExtras.h"
21 #include "llvm/ADT/SmallString.h"
22 #include "llvm/ADT/StringExtras.h"
23 #include "llvm/ADT/StringMap.h"
24 #include "llvm/ADT/StringRef.h"
25 #include "llvm/ADT/TinyPtrVector.h"
26 #include "llvm/IR/ConstantRange.h"
27 #include "llvm/IR/GlobalValue.h"
28 #include "llvm/IR/Module.h"
29 #include "llvm/Support/Allocator.h"
34 #include <algorithm>
35 #include <array>
36 #include <cassert>
37 #include <cstddef>
38 #include <cstdint>
39 #include <map>
40 #include <memory>
41 #include <set>
42 #include <string>
43 #include <utility>
44 #include <vector>
45 
46 namespace llvm {
47 
48 template <class GraphType> struct GraphTraits;
49 
50 namespace yaml {
51 
52 template <typename T> struct MappingTraits;
53 
54 } // end namespace yaml
55 
56 /// Class to accumulate and hold information about a callee.
57 struct CalleeInfo {
58  enum class HotnessType : uint8_t {
59  Unknown = 0,
60  Cold = 1,
61  None = 2,
62  Hot = 3,
63  Critical = 4
64  };
65 
66  // The size of the bit-field might need to be adjusted if more values are
67  // added to HotnessType enum.
69 
70  /// The value stored in RelBlockFreq has to be interpreted as the digits of
71  /// a scaled number with a scale of \p -ScaleShift.
73  static constexpr int32_t ScaleShift = 8;
74  static constexpr uint64_t MaxRelBlockFreq = (1 << 29) - 1;
75 
77  : Hotness(static_cast<uint32_t>(HotnessType::Unknown)), RelBlockFreq(0) {}
79  : Hotness(static_cast<uint32_t>(Hotness)), RelBlockFreq(RelBF) {}
80 
81  void updateHotness(const HotnessType OtherHotness) {
82  Hotness = std::max(Hotness, static_cast<uint32_t>(OtherHotness));
83  }
84 
86 
87  /// Update \p RelBlockFreq from \p BlockFreq and \p EntryFreq
88  ///
89  /// BlockFreq is divided by EntryFreq and added to RelBlockFreq. To represent
90  /// fractional values, the result is represented as a fixed point number with
91  /// scale of -ScaleShift.
92  void updateRelBlockFreq(uint64_t BlockFreq, uint64_t EntryFreq) {
93  if (EntryFreq == 0)
94  return;
96  Scaled64 Temp(BlockFreq, ScaleShift);
97  Temp /= Scaled64::get(EntryFreq);
98 
99  uint64_t Sum =
100  SaturatingAdd<uint64_t>(Temp.toInt<uint64_t>(), RelBlockFreq);
101  Sum = std::min(Sum, uint64_t(MaxRelBlockFreq));
102  RelBlockFreq = static_cast<uint32_t>(Sum);
103  }
104 };
105 
106 inline const char *getHotnessName(CalleeInfo::HotnessType HT) {
107  switch (HT) {
109  return "unknown";
111  return "cold";
113  return "none";
115  return "hot";
117  return "critical";
118  }
119  llvm_unreachable("invalid hotness");
120 }
121 
122 class GlobalValueSummary;
123 
124 using GlobalValueSummaryList = std::vector<std::unique_ptr<GlobalValueSummary>>;
125 
126 struct alignas(8) GlobalValueSummaryInfo {
127  union NameOrGV {
128  NameOrGV(bool HaveGVs) {
129  if (HaveGVs)
130  GV = nullptr;
131  else
132  Name = "";
133  }
134 
135  /// The GlobalValue corresponding to this summary. This is only used in
136  /// per-module summaries and when the IR is available. E.g. when module
137  /// analysis is being run, or when parsing both the IR and the summary
138  /// from assembly.
139  const GlobalValue *GV;
140 
141  /// Summary string representation. This StringRef points to BC module
142  /// string table and is valid until module data is stored in memory.
143  /// This is guaranteed to happen until runThinLTOBackend function is
144  /// called, so it is safe to use this field during thin link. This field
145  /// is only valid if summary index was loaded from BC file.
147  } U;
148 
149  GlobalValueSummaryInfo(bool HaveGVs) : U(HaveGVs) {}
150 
151  /// List of global value summary structures for a particular value held
152  /// in the GlobalValueMap. Requires a vector in the case of multiple
153  /// COMDAT values of the same name.
155 };
156 
157 /// Map from global value GUID to corresponding summary structures. Use a
158 /// std::map rather than a DenseMap so that pointers to the map's value_type
159 /// (which are used by ValueInfo) are not invalidated by insertion. Also it will
160 /// likely incur less overhead, as the value type is not very small and the size
161 /// of the map is unknown, resulting in inefficiencies due to repeated
162 /// insertions and resizing.
164  std::map<GlobalValue::GUID, GlobalValueSummaryInfo>;
165 
166 /// Struct that holds a reference to a particular GUID in a global value
167 /// summary.
168 struct ValueInfo {
169  enum Flags { HaveGV = 1, ReadOnly = 2, WriteOnly = 4 };
172 
173  ValueInfo() = default;
174  ValueInfo(bool HaveGVs, const GlobalValueSummaryMapTy::value_type *R) {
176  RefAndFlags.setInt(HaveGVs);
177  }
178 
179  explicit operator bool() const { return getRef(); }
180 
181  GlobalValue::GUID getGUID() const { return getRef()->first; }
182  const GlobalValue *getValue() const {
183  assert(haveGVs());
184  return getRef()->second.U.GV;
185  }
186 
188  return getRef()->second.SummaryList;
189  }
190 
191  StringRef name() const {
192  return haveGVs() ? getRef()->second.U.GV->getName()
193  : getRef()->second.U.Name;
194  }
195 
196  bool haveGVs() const { return RefAndFlags.getInt() & HaveGV; }
197  bool isReadOnly() const {
199  return RefAndFlags.getInt() & ReadOnly;
200  }
201  bool isWriteOnly() const {
203  return RefAndFlags.getInt() & WriteOnly;
204  }
205  unsigned getAccessSpecifier() const {
207  return RefAndFlags.getInt() & (ReadOnly | WriteOnly);
208  }
209  bool isValidAccessSpecifier() const {
210  unsigned BadAccessMask = ReadOnly | WriteOnly;
211  return (RefAndFlags.getInt() & BadAccessMask) != BadAccessMask;
212  }
213  void setReadOnly() {
214  // We expect ro/wo attribute to set only once during
215  // ValueInfo lifetime.
216  assert(getAccessSpecifier() == 0);
218  }
219  void setWriteOnly() {
220  assert(getAccessSpecifier() == 0);
222  }
223 
224  const GlobalValueSummaryMapTy::value_type *getRef() const {
225  return RefAndFlags.getPointer();
226  }
227 
228  /// Returns the most constraining visibility among summaries. The
229  /// visibilities, ordered from least to most constraining, are: default,
230  /// protected and hidden.
232 
233  /// Checks if all summaries are DSO local (have the flag set). When DSOLocal
234  /// propagation has been done, set the parameter to enable fast check.
235  bool isDSOLocal(bool WithDSOLocalPropagation = false) const;
236 
237  /// Checks if all copies are eligible for auto-hiding (have flag set).
238  bool canAutoHide() const;
239 };
240 
242  OS << VI.getGUID();
243  if (!VI.name().empty())
244  OS << " (" << VI.name() << ")";
245  return OS;
246 }
247 
248 inline bool operator==(const ValueInfo &A, const ValueInfo &B) {
249  assert(A.getRef() && B.getRef() &&
250  "Need ValueInfo with non-null Ref for comparison");
251  return A.getRef() == B.getRef();
252 }
253 
254 inline bool operator!=(const ValueInfo &A, const ValueInfo &B) {
255  assert(A.getRef() && B.getRef() &&
256  "Need ValueInfo with non-null Ref for comparison");
257  return A.getRef() != B.getRef();
258 }
259 
260 inline bool operator<(const ValueInfo &A, const ValueInfo &B) {
261  assert(A.getRef() && B.getRef() &&
262  "Need ValueInfo with non-null Ref to compare GUIDs");
263  return A.getGUID() < B.getGUID();
264 }
265 
266 template <> struct DenseMapInfo<ValueInfo> {
267  static inline ValueInfo getEmptyKey() {
268  return ValueInfo(false, (GlobalValueSummaryMapTy::value_type *)-8);
269  }
270 
271  static inline ValueInfo getTombstoneKey() {
272  return ValueInfo(false, (GlobalValueSummaryMapTy::value_type *)-16);
273  }
274 
275  static inline bool isSpecialKey(ValueInfo V) {
276  return V == getTombstoneKey() || V == getEmptyKey();
277  }
278 
279  static bool isEqual(ValueInfo L, ValueInfo R) {
280  // We are not supposed to mix ValueInfo(s) with different HaveGVs flag
281  // in a same container.
282  assert(isSpecialKey(L) || isSpecialKey(R) || (L.haveGVs() == R.haveGVs()));
283  return L.getRef() == R.getRef();
284  }
285  static unsigned getHashValue(ValueInfo I) { return (uintptr_t)I.getRef(); }
286 };
287 
288 /// Function and variable summary information to aid decisions and
289 /// implementation of importing.
291 public:
292  /// Sububclass discriminator (for dyn_cast<> et al.)
294 
295  /// Group flags (Linkage, NotEligibleToImport, etc.) as a bitfield.
296  struct GVFlags {
297  /// The linkage type of the associated global value.
298  ///
299  /// One use is to flag values that have local linkage types and need to
300  /// have module identifier appended before placing into the combined
301  /// index, to disambiguate from other values with the same name.
302  /// In the future this will be used to update and optimize linkage
303  /// types based on global summary-based analysis.
304  unsigned Linkage : 4;
305 
306  /// Indicates the visibility.
307  unsigned Visibility : 2;
308 
309  /// Indicate if the global value cannot be imported (e.g. it cannot
310  /// be renamed or references something that can't be renamed).
311  unsigned NotEligibleToImport : 1;
312 
313  /// In per-module summary, indicate that the global value must be considered
314  /// a live root for index-based liveness analysis. Used for special LLVM
315  /// values such as llvm.global_ctors that the linker does not know about.
316  ///
317  /// In combined summary, indicate that the global value is live.
318  unsigned Live : 1;
319 
320  /// Indicates that the linker resolved the symbol to a definition from
321  /// within the same linkage unit.
322  unsigned DSOLocal : 1;
323 
324  /// In the per-module summary, indicates that the global value is
325  /// linkonce_odr and global unnamed addr (so eligible for auto-hiding
326  /// via hidden visibility). In the combined summary, indicates that the
327  /// prevailing linkonce_odr copy can be auto-hidden via hidden visibility
328  /// when it is upgraded to weak_odr in the backend. This is legal when
329  /// all copies are eligible for auto-hiding (i.e. all copies were
330  /// linkonce_odr global unnamed addr. If any copy is not (e.g. it was
331  /// originally weak_odr, we cannot auto-hide the prevailing copy as it
332  /// means the symbol was externally visible.
333  unsigned CanAutoHide : 1;
334 
335  /// Convenience Constructors
338  bool NotEligibleToImport, bool Live, bool IsLocal,
339  bool CanAutoHide)
342  DSOLocal(IsLocal), CanAutoHide(CanAutoHide) {}
343  };
344 
345 private:
346  /// Kind of summary for use in dyn_cast<> et al.
347  SummaryKind Kind;
348 
349  GVFlags Flags;
350 
351  /// This is the hash of the name of the symbol in the original file. It is
352  /// identical to the GUID for global symbols, but differs for local since the
353  /// GUID includes the module level id in the hash.
354  GlobalValue::GUID OriginalName = 0;
355 
356  /// Path of module IR containing value's definition, used to locate
357  /// module during importing.
358  ///
359  /// This is only used during parsing of the combined index, or when
360  /// parsing the per-module index for creation of the combined summary index,
361  /// not during writing of the per-module index which doesn't contain a
362  /// module path string table.
363  StringRef ModulePath;
364 
365  /// List of values referenced by this global value's definition
366  /// (either by the initializer of a global variable, or referenced
367  /// from within a function). This does not include functions called, which
368  /// are listed in the derived FunctionSummary object.
369  std::vector<ValueInfo> RefEdgeList;
370 
371 protected:
372  GlobalValueSummary(SummaryKind K, GVFlags Flags, std::vector<ValueInfo> Refs)
373  : Kind(K), Flags(Flags), RefEdgeList(std::move(Refs)) {
374  assert((K != AliasKind || Refs.empty()) &&
375  "Expect no references for AliasSummary");
376  }
377 
378 public:
379  virtual ~GlobalValueSummary() = default;
380 
381  /// Returns the hash of the original name, it is identical to the GUID for
382  /// externally visible symbols, but not for local ones.
383  GlobalValue::GUID getOriginalName() const { return OriginalName; }
384 
385  /// Initialize the original name hash in this summary.
386  void setOriginalName(GlobalValue::GUID Name) { OriginalName = Name; }
387 
388  /// Which kind of summary subclass this is.
389  SummaryKind getSummaryKind() const { return Kind; }
390 
391  /// Set the path to the module containing this function, for use in
392  /// the combined index.
393  void setModulePath(StringRef ModPath) { ModulePath = ModPath; }
394 
395  /// Get the path to the module containing this function.
396  StringRef modulePath() const { return ModulePath; }
397 
398  /// Get the flags for this GlobalValue (see \p struct GVFlags).
399  GVFlags flags() const { return Flags; }
400 
401  /// Return linkage type recorded for this global value.
403  return static_cast<GlobalValue::LinkageTypes>(Flags.Linkage);
404  }
405 
406  /// Sets the linkage to the value determined by global summary-based
407  /// optimization. Will be applied in the ThinLTO backends.
409  Flags.Linkage = Linkage;
410  }
411 
412  /// Return true if this global value can't be imported.
413  bool notEligibleToImport() const { return Flags.NotEligibleToImport; }
414 
415  bool isLive() const { return Flags.Live; }
416 
417  void setLive(bool Live) { Flags.Live = Live; }
418 
419  void setDSOLocal(bool Local) { Flags.DSOLocal = Local; }
420 
421  bool isDSOLocal() const { return Flags.DSOLocal; }
422 
423  void setCanAutoHide(bool CanAutoHide) { Flags.CanAutoHide = CanAutoHide; }
424 
425  bool canAutoHide() const { return Flags.CanAutoHide; }
426 
428  return (GlobalValue::VisibilityTypes)Flags.Visibility;
429  }
431  Flags.Visibility = (unsigned)Vis;
432  }
433 
434  /// Flag that this global value cannot be imported.
435  void setNotEligibleToImport() { Flags.NotEligibleToImport = true; }
436 
437  /// Return the list of values referenced by this global value definition.
438  ArrayRef<ValueInfo> refs() const { return RefEdgeList; }
439 
440  /// If this is an alias summary, returns the summary of the aliased object (a
441  /// global variable or function), otherwise returns itself.
443  const GlobalValueSummary *getBaseObject() const;
444 
445  friend class ModuleSummaryIndex;
446 };
447 
448 /// Alias summary information.
450  ValueInfo AliaseeValueInfo;
451 
452  /// This is the Aliasee in the same module as alias (could get from VI, trades
453  /// memory for time). Note that this pointer may be null (and the value info
454  /// empty) when we have a distributed index where the alias is being imported
455  /// (as a copy of the aliasee), but the aliasee is not.
456  GlobalValueSummary *AliaseeSummary;
457 
458 public:
461  AliaseeSummary(nullptr) {}
462 
463  /// Check if this is an alias summary.
464  static bool classof(const GlobalValueSummary *GVS) {
465  return GVS->getSummaryKind() == AliasKind;
466  }
467 
468  void setAliasee(ValueInfo &AliaseeVI, GlobalValueSummary *Aliasee) {
469  AliaseeValueInfo = AliaseeVI;
470  AliaseeSummary = Aliasee;
471  }
472 
473  bool hasAliasee() const {
474  assert(!!AliaseeSummary == (AliaseeValueInfo &&
475  !AliaseeValueInfo.getSummaryList().empty()) &&
476  "Expect to have both aliasee summary and summary list or neither");
477  return !!AliaseeSummary;
478  }
479 
481  assert(AliaseeSummary && "Unexpected missing aliasee summary");
482  return *AliaseeSummary;
483  }
484 
486  return const_cast<GlobalValueSummary &>(
487  static_cast<const AliasSummary *>(this)->getAliasee());
488  }
490  assert(AliaseeValueInfo && "Unexpected missing aliasee");
491  return AliaseeValueInfo;
492  }
494  assert(AliaseeValueInfo && "Unexpected missing aliasee");
495  return AliaseeValueInfo.getGUID();
496  }
497 };
498 
500  if (auto *AS = dyn_cast<AliasSummary>(this))
501  return &AS->getAliasee();
502  return this;
503 }
504 
506  if (auto *AS = dyn_cast<AliasSummary>(this))
507  return &AS->getAliasee();
508  return this;
509 }
510 
511 /// Function summary information to aid decisions and implementation of
512 /// importing.
514 public:
515  /// <CalleeValueInfo, CalleeInfo> call edge pair.
516  using EdgeTy = std::pair<ValueInfo, CalleeInfo>;
517 
518  /// Types for -force-summary-edges-cold debugging option.
519  enum ForceSummaryHotnessType : unsigned {
523  };
524 
525  /// An "identifier" for a virtual function. This contains the type identifier
526  /// represented as a GUID and the offset from the address point to the virtual
527  /// function pointer, where "address point" is as defined in the Itanium ABI:
528  /// https://itanium-cxx-abi.github.io/cxx-abi/abi.html#vtable-general
529  struct VFuncId {
532  };
533 
534  /// A specification for a virtual function call with all constant integer
535  /// arguments. This is used to perform virtual constant propagation on the
536  /// summary.
537  struct ConstVCall {
539  std::vector<uint64_t> Args;
540  };
541 
542  /// All type identifier related information. Because these fields are
543  /// relatively uncommon we only allocate space for them if necessary.
544  struct TypeIdInfo {
545  /// List of type identifiers used by this function in llvm.type.test
546  /// intrinsics referenced by something other than an llvm.assume intrinsic,
547  /// represented as GUIDs.
548  std::vector<GlobalValue::GUID> TypeTests;
549 
550  /// List of virtual calls made by this function using (respectively)
551  /// llvm.assume(llvm.type.test) or llvm.type.checked.load intrinsics that do
552  /// not have all constant integer arguments.
554 
555  /// List of virtual calls made by this function using (respectively)
556  /// llvm.assume(llvm.type.test) or llvm.type.checked.load intrinsics with
557  /// all constant integer arguments.
558  std::vector<ConstVCall> TypeTestAssumeConstVCalls,
560  };
561 
562  /// Flags specific to function summaries.
563  struct FFlags {
564  // Function attribute flags. Used to track if a function accesses memory,
565  // recurses or aliases.
566  unsigned ReadNone : 1;
567  unsigned ReadOnly : 1;
568  unsigned NoRecurse : 1;
569  unsigned ReturnDoesNotAlias : 1;
570 
571  // Indicate if the global value cannot be inlined.
572  unsigned NoInline : 1;
573  // Indicate if function should be always inlined.
574  unsigned AlwaysInline : 1;
575  // Indicate if function never raises an exception. Can be modified during
576  // thinlink function attribute propagation
577  unsigned NoUnwind : 1;
578  // Indicate if function contains instructions that mayThrow
579  unsigned MayThrow : 1;
580 
581  // If there are calls to unknown targets (e.g. indirect)
582  unsigned HasUnknownCall : 1;
583 
584  FFlags &operator&=(const FFlags &RHS) {
585  this->ReadNone &= RHS.ReadNone;
586  this->ReadOnly &= RHS.ReadOnly;
587  this->NoRecurse &= RHS.NoRecurse;
589  this->NoInline &= RHS.NoInline;
590  this->AlwaysInline &= RHS.AlwaysInline;
591  this->NoUnwind &= RHS.NoUnwind;
592  this->MayThrow &= RHS.MayThrow;
593  this->HasUnknownCall &= RHS.HasUnknownCall;
594  return *this;
595  }
596 
597  bool anyFlagSet() {
598  return this->ReadNone | this->ReadOnly | this->NoRecurse |
599  this->ReturnDoesNotAlias | this->NoInline | this->AlwaysInline |
600  this->NoUnwind | this->MayThrow | this->HasUnknownCall;
601  }
602 
603  operator std::string() {
604  std::string Output;
605  raw_string_ostream OS(Output);
606  OS << "funcFlags: (";
607  OS << "readNone: " << this->ReadNone;
608  OS << ", readOnly: " << this->ReadOnly;
609  OS << ", noRecurse: " << this->NoRecurse;
610  OS << ", returnDoesNotAlias: " << this->ReturnDoesNotAlias;
611  OS << ", noInline: " << this->NoInline;
612  OS << ", alwaysInline: " << this->AlwaysInline;
613  OS << ", noUnwind: " << this->NoUnwind;
614  OS << ", mayThrow: " << this->MayThrow;
615  OS << ", hasUnknownCall: " << this->HasUnknownCall;
616  OS << ")";
617  return OS.str();
618  }
619  };
620 
621  /// Describes the uses of a parameter by the function.
622  struct ParamAccess {
623  static constexpr uint32_t RangeWidth = 64;
624 
625  /// Describes the use of a value in a call instruction, specifying the
626  /// call's target, the value's parameter number, and the possible range of
627  /// offsets from the beginning of the value that are passed.
628  struct Call {
631  ConstantRange Offsets{/*BitWidth=*/RangeWidth, /*isFullSet=*/true};
632 
633  Call() = default;
636  };
637 
639  /// The range contains byte offsets from the parameter pointer which
640  /// accessed by the function. In the per-module summary, it only includes
641  /// accesses made by the function instructions. In the combined summary, it
642  /// also includes accesses by nested function calls.
643  ConstantRange Use{/*BitWidth=*/RangeWidth, /*isFullSet=*/true};
644  /// In the per-module summary, it summarizes the byte offset applied to each
645  /// pointer parameter before passing to each corresponding callee.
646  /// In the combined summary, it's empty and information is propagated by
647  /// inter-procedural analysis and applied to the Use field.
648  std::vector<Call> Calls;
649 
650  ParamAccess() = default;
652  : ParamNo(ParamNo), Use(Use) {}
653  };
654 
655  /// Create an empty FunctionSummary (with specified call edges).
656  /// Used to represent external nodes and the dummy root node.
657  static FunctionSummary
658  makeDummyFunctionSummary(std::vector<FunctionSummary::EdgeTy> Edges) {
659  return FunctionSummary(
661  GlobalValue::LinkageTypes::AvailableExternallyLinkage,
663  /*NotEligibleToImport=*/true, /*Live=*/true, /*IsLocal=*/false,
664  /*CanAutoHide=*/false),
665  /*NumInsts=*/0, FunctionSummary::FFlags{}, /*EntryCount=*/0,
666  std::vector<ValueInfo>(), std::move(Edges),
667  std::vector<GlobalValue::GUID>(),
668  std::vector<FunctionSummary::VFuncId>(),
669  std::vector<FunctionSummary::VFuncId>(),
670  std::vector<FunctionSummary::ConstVCall>(),
671  std::vector<FunctionSummary::ConstVCall>(),
672  std::vector<FunctionSummary::ParamAccess>());
673  }
674 
675  /// A dummy node to reference external functions that aren't in the index
677 
678 private:
679  /// Number of instructions (ignoring debug instructions, e.g.) computed
680  /// during the initial compile step when the summary index is first built.
681  unsigned InstCount;
682 
683  /// Function summary specific flags.
684  FFlags FunFlags;
685 
686  /// The synthesized entry count of the function.
687  /// This is only populated during ThinLink phase and remains unused while
688  /// generating per-module summaries.
689  uint64_t EntryCount = 0;
690 
691  /// List of <CalleeValueInfo, CalleeInfo> call edge pairs from this function.
692  std::vector<EdgeTy> CallGraphEdgeList;
693 
694  std::unique_ptr<TypeIdInfo> TIdInfo;
695 
696  /// Uses for every parameter to this function.
697  using ParamAccessesTy = std::vector<ParamAccess>;
698  std::unique_ptr<ParamAccessesTy> ParamAccesses;
699 
700 public:
701  FunctionSummary(GVFlags Flags, unsigned NumInsts, FFlags FunFlags,
702  uint64_t EntryCount, std::vector<ValueInfo> Refs,
703  std::vector<EdgeTy> CGEdges,
704  std::vector<GlobalValue::GUID> TypeTests,
705  std::vector<VFuncId> TypeTestAssumeVCalls,
706  std::vector<VFuncId> TypeCheckedLoadVCalls,
707  std::vector<ConstVCall> TypeTestAssumeConstVCalls,
708  std::vector<ConstVCall> TypeCheckedLoadConstVCalls,
709  std::vector<ParamAccess> Params)
710  : GlobalValueSummary(FunctionKind, Flags, std::move(Refs)),
711  InstCount(NumInsts), FunFlags(FunFlags), EntryCount(EntryCount),
712  CallGraphEdgeList(std::move(CGEdges)) {
713  if (!TypeTests.empty() || !TypeTestAssumeVCalls.empty() ||
714  !TypeCheckedLoadVCalls.empty() || !TypeTestAssumeConstVCalls.empty() ||
715  !TypeCheckedLoadConstVCalls.empty())
716  TIdInfo = std::make_unique<TypeIdInfo>(
717  TypeIdInfo{std::move(TypeTests), std::move(TypeTestAssumeVCalls),
718  std::move(TypeCheckedLoadVCalls),
719  std::move(TypeTestAssumeConstVCalls),
720  std::move(TypeCheckedLoadConstVCalls)});
721  if (!Params.empty())
722  ParamAccesses = std::make_unique<ParamAccessesTy>(std::move(Params));
723  }
724  // Gets the number of readonly and writeonly refs in RefEdgeList
725  std::pair<unsigned, unsigned> specialRefCounts() const;
726 
727  /// Check if this is a function summary.
728  static bool classof(const GlobalValueSummary *GVS) {
729  return GVS->getSummaryKind() == FunctionKind;
730  }
731 
732  /// Get function summary flags.
733  FFlags fflags() const { return FunFlags; }
734 
735  void setNoRecurse() { FunFlags.NoRecurse = true; }
736 
737  void setNoUnwind() { FunFlags.NoUnwind = true; }
738 
739  /// Get the instruction count recorded for this function.
740  unsigned instCount() const { return InstCount; }
741 
742  /// Get the synthetic entry count for this function.
743  uint64_t entryCount() const { return EntryCount; }
744 
745  /// Set the synthetic entry count for this function.
746  void setEntryCount(uint64_t EC) { EntryCount = EC; }
747 
748  /// Return the list of <CalleeValueInfo, CalleeInfo> pairs.
749  ArrayRef<EdgeTy> calls() const { return CallGraphEdgeList; }
750 
751  std::vector<EdgeTy> &mutableCalls() { return CallGraphEdgeList; }
752 
753  void addCall(EdgeTy E) { CallGraphEdgeList.push_back(E); }
754 
755  /// Returns the list of type identifiers used by this function in
756  /// llvm.type.test intrinsics other than by an llvm.assume intrinsic,
757  /// represented as GUIDs.
759  if (TIdInfo)
760  return TIdInfo->TypeTests;
761  return {};
762  }
763 
764  /// Returns the list of virtual calls made by this function using
765  /// llvm.assume(llvm.type.test) intrinsics that do not have all constant
766  /// integer arguments.
768  if (TIdInfo)
769  return TIdInfo->TypeTestAssumeVCalls;
770  return {};
771  }
772 
773  /// Returns the list of virtual calls made by this function using
774  /// llvm.type.checked.load intrinsics that do not have all constant integer
775  /// arguments.
777  if (TIdInfo)
778  return TIdInfo->TypeCheckedLoadVCalls;
779  return {};
780  }
781 
782  /// Returns the list of virtual calls made by this function using
783  /// llvm.assume(llvm.type.test) intrinsics with all constant integer
784  /// arguments.
786  if (TIdInfo)
787  return TIdInfo->TypeTestAssumeConstVCalls;
788  return {};
789  }
790 
791  /// Returns the list of virtual calls made by this function using
792  /// llvm.type.checked.load intrinsics with all constant integer arguments.
794  if (TIdInfo)
795  return TIdInfo->TypeCheckedLoadConstVCalls;
796  return {};
797  }
798 
799  /// Returns the list of known uses of pointer parameters.
801  if (ParamAccesses)
802  return *ParamAccesses;
803  return {};
804  }
805 
806  /// Sets the list of known uses of pointer parameters.
807  void setParamAccesses(std::vector<ParamAccess> NewParams) {
808  if (NewParams.empty())
809  ParamAccesses.reset();
810  else if (ParamAccesses)
811  *ParamAccesses = std::move(NewParams);
812  else
813  ParamAccesses = std::make_unique<ParamAccessesTy>(std::move(NewParams));
814  }
815 
816  /// Add a type test to the summary. This is used by WholeProgramDevirt if we
817  /// were unable to devirtualize a checked call.
819  if (!TIdInfo)
820  TIdInfo = std::make_unique<TypeIdInfo>();
821  TIdInfo->TypeTests.push_back(Guid);
822  }
823 
824  const TypeIdInfo *getTypeIdInfo() const { return TIdInfo.get(); };
825 
826  friend struct GraphTraits<ValueInfo>;
827 };
828 
829 template <> struct DenseMapInfo<FunctionSummary::VFuncId> {
830  static FunctionSummary::VFuncId getEmptyKey() { return {0, uint64_t(-1)}; }
831 
833  return {0, uint64_t(-2)};
834  }
835 
837  return L.GUID == R.GUID && L.Offset == R.Offset;
838  }
839 
840  static unsigned getHashValue(FunctionSummary::VFuncId I) { return I.GUID; }
841 };
842 
843 template <> struct DenseMapInfo<FunctionSummary::ConstVCall> {
845  return {{0, uint64_t(-1)}, {}};
846  }
847 
849  return {{0, uint64_t(-2)}, {}};
850  }
851 
855  L.Args == R.Args;
856  }
857 
859  return I.VFunc.GUID;
860  }
861 };
862 
863 /// The ValueInfo and offset for a function within a vtable definition
864 /// initializer array.
867  : FuncVI(VI), VTableOffset(Offset) {}
868 
871 };
872 /// List of functions referenced by a particular vtable definition.
873 using VTableFuncList = std::vector<VirtFuncOffset>;
874 
875 /// Global variable summary information to aid decisions and
876 /// implementation of importing.
877 ///
878 /// Global variable summary has two extra flag, telling if it is
879 /// readonly or writeonly. Both readonly and writeonly variables
880 /// can be optimized in the backed: readonly variables can be
881 /// const-folded, while writeonly vars can be completely eliminated
882 /// together with corresponding stores. We let both things happen
883 /// by means of internalizing such variables after ThinLTO import.
885 private:
886  /// For vtable definitions this holds the list of functions and
887  /// their corresponding offsets within the initializer array.
888  std::unique_ptr<VTableFuncList> VTableFuncs;
889 
890 public:
891  struct GVarFlags {
892  GVarFlags(bool ReadOnly, bool WriteOnly, bool Constant,
894  : MaybeReadOnly(ReadOnly), MaybeWriteOnly(WriteOnly),
896 
897  // If true indicates that this global variable might be accessed
898  // purely by non-volatile load instructions. This in turn means
899  // it can be internalized in source and destination modules during
900  // thin LTO import because it neither modified nor its address
901  // is taken.
902  unsigned MaybeReadOnly : 1;
903  // If true indicates that variable is possibly only written to, so
904  // its value isn't loaded and its address isn't taken anywhere.
905  // False, when 'Constant' attribute is set.
906  unsigned MaybeWriteOnly : 1;
907  // Indicates that value is a compile-time constant. Global variable
908  // can be 'Constant' while not being 'ReadOnly' on several occasions:
909  // - it is volatile, (e.g mapped device address)
910  // - its address is taken, meaning that unlike 'ReadOnly' vars we can't
911  // internalize it.
912  // Constant variables are always imported thus giving compiler an
913  // opportunity to make some extra optimizations. Readonly constants
914  // are also internalized.
915  unsigned Constant : 1;
916  // Set from metadata on vtable definitions during the module summary
917  // analysis.
918  unsigned VCallVisibility : 2;
919  } VarFlags;
920 
922  std::vector<ValueInfo> Refs)
923  : GlobalValueSummary(GlobalVarKind, Flags, std::move(Refs)),
924  VarFlags(VarFlags) {}
925 
926  /// Check if this is a global variable summary.
927  static bool classof(const GlobalValueSummary *GVS) {
928  return GVS->getSummaryKind() == GlobalVarKind;
929  }
930 
931  GVarFlags varflags() const { return VarFlags; }
932  void setReadOnly(bool RO) { VarFlags.MaybeReadOnly = RO; }
933  void setWriteOnly(bool WO) { VarFlags.MaybeWriteOnly = WO; }
934  bool maybeReadOnly() const { return VarFlags.MaybeReadOnly; }
935  bool maybeWriteOnly() const { return VarFlags.MaybeWriteOnly; }
936  bool isConstant() const { return VarFlags.Constant; }
939  }
942  }
943 
945  assert(!VTableFuncs);
946  VTableFuncs = std::make_unique<VTableFuncList>(std::move(Funcs));
947  }
948 
950  if (VTableFuncs)
951  return *VTableFuncs;
952  return {};
953  }
954 };
955 
957  /// Specifies which kind of type check we should emit for this byte array.
958  /// See http://clang.llvm.org/docs/ControlFlowIntegrityDesign.html for full
959  /// details on each kind of check; the enumerators are described with
960  /// reference to that document.
961  enum Kind {
962  Unsat, ///< Unsatisfiable type (i.e. no global has this type metadata)
963  ByteArray, ///< Test a byte array (first example)
964  Inline, ///< Inlined bit vector ("Short Inline Bit Vectors")
965  Single, ///< Single element (last example in "Short Inline Bit Vectors")
966  AllOnes, ///< All-ones bit vector ("Eliminating Bit Vector Checks for
967  /// All-Ones Bit Vectors")
968  Unknown, ///< Unknown (analysis not performed, don't lower)
969  } TheKind = Unknown;
970 
971  /// Range of size-1 expressed as a bit width. For example, if the size is in
972  /// range [1,256], this number will be 8. This helps generate the most compact
973  /// instruction sequences.
974  unsigned SizeM1BitWidth = 0;
975 
976  // The following fields are only used if the target does not support the use
977  // of absolute symbols to store constants. Their meanings are the same as the
978  // corresponding fields in LowerTypeTestsModule::TypeIdLowering in
979  // LowerTypeTests.cpp.
980 
983  uint8_t BitMask = 0;
985 };
986 
988  enum Kind {
989  Indir, ///< Just do a regular virtual call
990  SingleImpl, ///< Single implementation devirtualization
991  BranchFunnel, ///< When retpoline mitigation is enabled, use a branch funnel
992  ///< that is defined in the merged module. Otherwise same as
993  ///< Indir.
994  } TheKind = Indir;
995 
996  std::string SingleImplName;
997 
998  struct ByArg {
999  enum Kind {
1000  Indir, ///< Just do a regular virtual call
1001  UniformRetVal, ///< Uniform return value optimization
1002  UniqueRetVal, ///< Unique return value optimization
1003  VirtualConstProp, ///< Virtual constant propagation
1004  } TheKind = Indir;
1005 
1006  /// Additional information for the resolution:
1007  /// - UniformRetVal: the uniform return value.
1008  /// - UniqueRetVal: the return value associated with the unique vtable (0 or
1009  /// 1).
1011 
1012  // The following fields are only used if the target does not support the use
1013  // of absolute symbols to store constants.
1014 
1017  };
1018 
1019  /// Resolutions for calls with all constant integer arguments (excluding the
1020  /// first argument, "this"), where the key is the argument vector.
1021  std::map<std::vector<uint64_t>, ByArg> ResByArg;
1022 };
1023 
1026 
1027  /// Mapping from byte offset to whole-program devirt resolution for that
1028  /// (typeid, byte offset) pair.
1029  std::map<uint64_t, WholeProgramDevirtResolution> WPDRes;
1030 };
1031 
1032 /// 160 bits SHA1
1033 using ModuleHash = std::array<uint32_t, 5>;
1034 
1035 /// Type used for iterating through the global value summary map.
1036 using const_gvsummary_iterator = GlobalValueSummaryMapTy::const_iterator;
1037 using gvsummary_iterator = GlobalValueSummaryMapTy::iterator;
1038 
1039 /// String table to hold/own module path strings, which additionally holds the
1040 /// module ID assigned to each module during the plugin step, as well as a hash
1041 /// of the module. The StringMap makes a copy of and owns inserted strings.
1043 
1044 /// Map of global value GUID to its summary, used to identify values defined in
1045 /// a particular module, and provide efficient access to their summary.
1047 
1048 /// Map of a type GUID to type id string and summary (multimap used
1049 /// in case of GUID conflicts).
1050 using TypeIdSummaryMapTy =
1051  std::multimap<GlobalValue::GUID, std::pair<std::string, TypeIdSummary>>;
1052 
1053 /// The following data structures summarize type metadata information.
1054 /// For type metadata overview see https://llvm.org/docs/TypeMetadata.html.
1055 /// Each type metadata includes both the type identifier and the offset of
1056 /// the address point of the type (the address held by objects of that type
1057 /// which may not be the beginning of the virtual table). Vtable definitions
1058 /// are decorated with type metadata for the types they are compatible with.
1059 ///
1060 /// Holds information about vtable definitions decorated with type metadata:
1061 /// the vtable definition value and its address point offset in a type
1062 /// identifier metadata it is decorated (compatible) with.
1066 
1069 };
1070 /// List of vtable definitions decorated by a particular type identifier,
1071 /// and their corresponding offsets in that type identifier's metadata.
1072 /// Note that each type identifier may be compatible with multiple vtables, due
1073 /// to inheritance, which is why this is a vector.
1074 using TypeIdCompatibleVtableInfo = std::vector<TypeIdOffsetVtableInfo>;
1075 
1076 /// Class to hold module path string table and global value map,
1077 /// and encapsulate methods for operating on them.
1079 private:
1080  /// Map from value name to list of summary instances for values of that
1081  /// name (may be duplicates in the COMDAT case, e.g.).
1082  GlobalValueSummaryMapTy GlobalValueMap;
1083 
1084  /// Holds strings for combined index, mapping to the corresponding module ID.
1085  ModulePathStringTableTy ModulePathStringTable;
1086 
1087  /// Mapping from type identifier GUIDs to type identifier and its summary
1088  /// information. Produced by thin link.
1089  TypeIdSummaryMapTy TypeIdMap;
1090 
1091  /// Mapping from type identifier to information about vtables decorated
1092  /// with that type identifier's metadata. Produced by per module summary
1093  /// analysis and consumed by thin link. For more information, see description
1094  /// above where TypeIdCompatibleVtableInfo is defined.
1095  std::map<std::string, TypeIdCompatibleVtableInfo, std::less<>>
1096  TypeIdCompatibleVtableMap;
1097 
1098  /// Mapping from original ID to GUID. If original ID can map to multiple
1099  /// GUIDs, it will be mapped to 0.
1100  std::map<GlobalValue::GUID, GlobalValue::GUID> OidGuidMap;
1101 
1102  /// Indicates that summary-based GlobalValue GC has run, and values with
1103  /// GVFlags::Live==false are really dead. Otherwise, all values must be
1104  /// considered live.
1105  bool WithGlobalValueDeadStripping = false;
1106 
1107  /// Indicates that summary-based attribute propagation has run and
1108  /// GVarFlags::MaybeReadonly / GVarFlags::MaybeWriteonly are really
1109  /// read/write only.
1110  bool WithAttributePropagation = false;
1111 
1112  /// Indicates that summary-based DSOLocal propagation has run and the flag in
1113  /// every summary of a GV is synchronized.
1114  bool WithDSOLocalPropagation = false;
1115 
1116  /// Indicates that summary-based synthetic entry count propagation has run
1117  bool HasSyntheticEntryCounts = false;
1118 
1119  /// Indicates that distributed backend should skip compilation of the
1120  /// module. Flag is suppose to be set by distributed ThinLTO indexing
1121  /// when it detected that the module is not needed during the final
1122  /// linking. As result distributed backend should just output a minimal
1123  /// valid object file.
1124  bool SkipModuleByDistributedBackend = false;
1125 
1126  /// If true then we're performing analysis of IR module, or parsing along with
1127  /// the IR from assembly. The value of 'false' means we're reading summary
1128  /// from BC or YAML source. Affects the type of value stored in NameOrGV
1129  /// union.
1130  bool HaveGVs;
1131 
1132  // True if the index was created for a module compiled with -fsplit-lto-unit.
1133  bool EnableSplitLTOUnit;
1134 
1135  // True if some of the modules were compiled with -fsplit-lto-unit and
1136  // some were not. Set when the combined index is created during the thin link.
1137  bool PartiallySplitLTOUnits = false;
1138 
1139  /// True if some of the FunctionSummary contains a ParamAccess.
1140  bool HasParamAccess = false;
1141 
1142  std::set<std::string> CfiFunctionDefs;
1143  std::set<std::string> CfiFunctionDecls;
1144 
1145  // Used in cases where we want to record the name of a global, but
1146  // don't have the string owned elsewhere (e.g. the Strtab on a module).
1147  StringSaver Saver;
1148  BumpPtrAllocator Alloc;
1149 
1150  // The total number of basic blocks in the module in the per-module summary or
1151  // the total number of basic blocks in the LTO unit in the combined index.
1152  uint64_t BlockCount;
1153 
1154  // YAML I/O support.
1156 
1157  GlobalValueSummaryMapTy::value_type *
1158  getOrInsertValuePtr(GlobalValue::GUID GUID) {
1159  return &*GlobalValueMap.emplace(GUID, GlobalValueSummaryInfo(HaveGVs))
1160  .first;
1161  }
1162 
1163 public:
1164  // See HaveGVs variable comment.
1165  ModuleSummaryIndex(bool HaveGVs, bool EnableSplitLTOUnit = false)
1166  : HaveGVs(HaveGVs), EnableSplitLTOUnit(EnableSplitLTOUnit), Saver(Alloc),
1167  BlockCount(0) {}
1168 
1169  // Current version for the module summary in bitcode files.
1170  // The BitcodeSummaryVersion should be bumped whenever we introduce changes
1171  // in the way some record are interpreted, like flags for instance.
1172  // Note that incrementing this may require changes in both BitcodeReader.cpp
1173  // and BitcodeWriter.cpp.
1174  static constexpr uint64_t BitcodeSummaryVersion = 9;
1175 
1176  // Regular LTO module name for ASM writer
1177  static constexpr const char *getRegularLTOModuleName() {
1178  return "[Regular LTO]";
1179  }
1180 
1181  bool haveGVs() const { return HaveGVs; }
1182 
1183  uint64_t getFlags() const;
1184  void setFlags(uint64_t Flags);
1185 
1186  uint64_t getBlockCount() const { return BlockCount; }
1187  void addBlockCount(uint64_t C) { BlockCount += C; }
1188  void setBlockCount(uint64_t C) { BlockCount = C; }
1189 
1190  gvsummary_iterator begin() { return GlobalValueMap.begin(); }
1191  const_gvsummary_iterator begin() const { return GlobalValueMap.begin(); }
1192  gvsummary_iterator end() { return GlobalValueMap.end(); }
1193  const_gvsummary_iterator end() const { return GlobalValueMap.end(); }
1194  size_t size() const { return GlobalValueMap.size(); }
1195 
1196  /// Convenience function for doing a DFS on a ValueInfo. Marks the function in
1197  /// the FunctionHasParent map.
1198  static void discoverNodes(ValueInfo V,
1199  std::map<ValueInfo, bool> &FunctionHasParent) {
1200  if (!V.getSummaryList().size())
1201  return; // skip external functions that don't have summaries
1202 
1203  // Mark discovered if we haven't yet
1204  auto S = FunctionHasParent.emplace(V, false);
1205 
1206  // Stop if we've already discovered this node
1207  if (!S.second)
1208  return;
1209 
1210  FunctionSummary *F =
1211  dyn_cast<FunctionSummary>(V.getSummaryList().front().get());
1212  assert(F != nullptr && "Expected FunctionSummary node");
1213 
1214  for (auto &C : F->calls()) {
1215  // Insert node if necessary
1216  auto S = FunctionHasParent.emplace(C.first, true);
1217 
1218  // Skip nodes that we're sure have parents
1219  if (!S.second && S.first->second)
1220  continue;
1221 
1222  if (S.second)
1223  discoverNodes(C.first, FunctionHasParent);
1224  else
1225  S.first->second = true;
1226  }
1227  }
1228 
1229  // Calculate the callgraph root
1231  // Functions that have a parent will be marked in FunctionHasParent pair.
1232  // Once we've marked all functions, the functions in the map that are false
1233  // have no parent (so they're the roots)
1234  std::map<ValueInfo, bool> FunctionHasParent;
1235 
1236  for (auto &S : *this) {
1237  // Skip external functions
1238  if (!S.second.SummaryList.size() ||
1239  !isa<FunctionSummary>(S.second.SummaryList.front().get()))
1240  continue;
1241  discoverNodes(ValueInfo(HaveGVs, &S), FunctionHasParent);
1242  }
1243 
1244  std::vector<FunctionSummary::EdgeTy> Edges;
1245  // create edges to all roots in the Index
1246  for (auto &P : FunctionHasParent) {
1247  if (P.second)
1248  continue; // skip over non-root nodes
1249  Edges.push_back(std::make_pair(P.first, CalleeInfo{}));
1250  }
1251  if (Edges.empty()) {
1252  // Failed to find root - return an empty node
1254  }
1255  auto CallGraphRoot = FunctionSummary::makeDummyFunctionSummary(Edges);
1256  return CallGraphRoot;
1257  }
1258 
1260  return WithGlobalValueDeadStripping;
1261  }
1263  WithGlobalValueDeadStripping = true;
1264  }
1265 
1266  bool withAttributePropagation() const { return WithAttributePropagation; }
1268  WithAttributePropagation = true;
1269  }
1270 
1271  bool withDSOLocalPropagation() const { return WithDSOLocalPropagation; }
1272  void setWithDSOLocalPropagation() { WithDSOLocalPropagation = true; }
1273 
1274  bool isReadOnly(const GlobalVarSummary *GVS) const {
1275  return WithAttributePropagation && GVS->maybeReadOnly();
1276  }
1277  bool isWriteOnly(const GlobalVarSummary *GVS) const {
1278  return WithAttributePropagation && GVS->maybeWriteOnly();
1279  }
1280 
1281  bool hasSyntheticEntryCounts() const { return HasSyntheticEntryCounts; }
1282  void setHasSyntheticEntryCounts() { HasSyntheticEntryCounts = true; }
1283 
1285  return SkipModuleByDistributedBackend;
1286  }
1288  SkipModuleByDistributedBackend = true;
1289  }
1290 
1291  bool enableSplitLTOUnit() const { return EnableSplitLTOUnit; }
1292  void setEnableSplitLTOUnit() { EnableSplitLTOUnit = true; }
1293 
1294  bool partiallySplitLTOUnits() const { return PartiallySplitLTOUnits; }
1295  void setPartiallySplitLTOUnits() { PartiallySplitLTOUnits = true; }
1296 
1297  bool hasParamAccess() const { return HasParamAccess; }
1298 
1299  bool isGlobalValueLive(const GlobalValueSummary *GVS) const {
1300  return !WithGlobalValueDeadStripping || GVS->isLive();
1301  }
1302  bool isGUIDLive(GlobalValue::GUID GUID) const;
1303 
1304  /// Return a ValueInfo for the index value_type (convenient when iterating
1305  /// index).
1306  ValueInfo getValueInfo(const GlobalValueSummaryMapTy::value_type &R) const {
1307  return ValueInfo(HaveGVs, &R);
1308  }
1309 
1310  /// Return a ValueInfo for GUID if it exists, otherwise return ValueInfo().
1312  auto I = GlobalValueMap.find(GUID);
1313  return ValueInfo(HaveGVs, I == GlobalValueMap.end() ? nullptr : &*I);
1314  }
1315 
1316  /// Return a ValueInfo for \p GUID.
1318  return ValueInfo(HaveGVs, getOrInsertValuePtr(GUID));
1319  }
1320 
1321  // Save a string in the Index. Use before passing Name to
1322  // getOrInsertValueInfo when the string isn't owned elsewhere (e.g. on the
1323  // module's Strtab).
1324  StringRef saveString(StringRef String) { return Saver.save(String); }
1325 
1326  /// Return a ValueInfo for \p GUID setting value \p Name.
1328  assert(!HaveGVs);
1329  auto VP = getOrInsertValuePtr(GUID);
1330  VP->second.U.Name = Name;
1331  return ValueInfo(HaveGVs, VP);
1332  }
1333 
1334  /// Return a ValueInfo for \p GV and mark it as belonging to GV.
1336  assert(HaveGVs);
1337  auto VP = getOrInsertValuePtr(GV->getGUID());
1338  VP->second.U.GV = GV;
1339  return ValueInfo(HaveGVs, VP);
1340  }
1341 
1342  /// Return the GUID for \p OriginalId in the OidGuidMap.
1344  const auto I = OidGuidMap.find(OriginalID);
1345  return I == OidGuidMap.end() ? 0 : I->second;
1346  }
1347 
1348  std::set<std::string> &cfiFunctionDefs() { return CfiFunctionDefs; }
1349  const std::set<std::string> &cfiFunctionDefs() const { return CfiFunctionDefs; }
1350 
1351  std::set<std::string> &cfiFunctionDecls() { return CfiFunctionDecls; }
1352  const std::set<std::string> &cfiFunctionDecls() const { return CfiFunctionDecls; }
1353 
1354  /// Add a global value summary for a value.
1356  std::unique_ptr<GlobalValueSummary> Summary) {
1358  }
1359 
1360  /// Add a global value summary for a value of the given name.
1362  std::unique_ptr<GlobalValueSummary> Summary) {
1364  std::move(Summary));
1365  }
1366 
1367  /// Add a global value summary for the given ValueInfo.
1369  std::unique_ptr<GlobalValueSummary> Summary) {
1370  if (const FunctionSummary *FS = dyn_cast<FunctionSummary>(Summary.get()))
1371  HasParamAccess |= !FS->paramAccesses().empty();
1372  addOriginalName(VI.getGUID(), Summary->getOriginalName());
1373  // Here we have a notionally const VI, but the value it points to is owned
1374  // by the non-const *this.
1375  const_cast<GlobalValueSummaryMapTy::value_type *>(VI.getRef())
1376  ->second.SummaryList.push_back(std::move(Summary));
1377  }
1378 
1379  /// Add an original name for the value of the given GUID.
1381  GlobalValue::GUID OrigGUID) {
1382  if (OrigGUID == 0 || ValueGUID == OrigGUID)
1383  return;
1384  if (OidGuidMap.count(OrigGUID) && OidGuidMap[OrigGUID] != ValueGUID)
1385  OidGuidMap[OrigGUID] = 0;
1386  else
1387  OidGuidMap[OrigGUID] = ValueGUID;
1388  }
1389 
1390  /// Find the summary for ValueInfo \p VI in module \p ModuleId, or nullptr if
1391  /// not found.
1393  auto SummaryList = VI.getSummaryList();
1394  auto Summary =
1395  llvm::find_if(SummaryList,
1396  [&](const std::unique_ptr<GlobalValueSummary> &Summary) {
1397  return Summary->modulePath() == ModuleId;
1398  });
1399  if (Summary == SummaryList.end())
1400  return nullptr;
1401  return Summary->get();
1402  }
1403 
1404  /// Find the summary for global \p GUID in module \p ModuleId, or nullptr if
1405  /// not found.
1407  StringRef ModuleId) const {
1408  auto CalleeInfo = getValueInfo(ValueGUID);
1409  if (!CalleeInfo)
1410  return nullptr; // This function does not have a summary
1411  return findSummaryInModule(CalleeInfo, ModuleId);
1412  }
1413 
1414  /// Returns the first GlobalValueSummary for \p GV, asserting that there
1415  /// is only one if \p PerModuleIndex.
1417  bool PerModuleIndex = true) const {
1418  assert(GV.hasName() && "Can't get GlobalValueSummary for GV with no name");
1419  return getGlobalValueSummary(GV.getGUID(), PerModuleIndex);
1420  }
1421 
1422  /// Returns the first GlobalValueSummary for \p ValueGUID, asserting that
1423  /// there
1424  /// is only one if \p PerModuleIndex.
1426  bool PerModuleIndex = true) const;
1427 
1428  /// Table of modules, containing module hash and id.
1430  return ModulePathStringTable;
1431  }
1432 
1433  /// Table of modules, containing hash and id.
1435  return ModulePathStringTable;
1436  }
1437 
1438  /// Get the module ID recorded for the given module path.
1439  uint64_t getModuleId(const StringRef ModPath) const {
1440  return ModulePathStringTable.lookup(ModPath).first;
1441  }
1442 
1443  /// Get the module SHA1 hash recorded for the given module path.
1444  const ModuleHash &getModuleHash(const StringRef ModPath) const {
1445  auto It = ModulePathStringTable.find(ModPath);
1446  assert(It != ModulePathStringTable.end() && "Module not registered");
1447  return It->second.second;
1448  }
1449 
1450  /// Convenience method for creating a promoted global name
1451  /// for the given value name of a local, and its original module's ID.
1452  static std::string getGlobalNameForLocal(StringRef Name, ModuleHash ModHash) {
1453  SmallString<256> NewName(Name);
1454  NewName += ".llvm.";
1455  NewName += utostr((uint64_t(ModHash[0]) << 32) |
1456  ModHash[1]); // Take the first 64 bits
1457  return std::string(NewName.str());
1458  }
1459 
1460  /// Helper to obtain the unpromoted name for a global value (or the original
1461  /// name if not promoted). Split off the rightmost ".llvm.${hash}" suffix,
1462  /// because it is possible in certain clients (not clang at the moment) for
1463  /// two rounds of ThinLTO optimization and therefore promotion to occur.
1465  std::pair<StringRef, StringRef> Pair = Name.rsplit(".llvm.");
1466  return Pair.first;
1467  }
1468 
1470 
1471  /// Add a new module with the given \p Hash, mapped to the given \p
1472  /// ModID, and return a reference to the module.
1474  ModuleHash Hash = ModuleHash{{0}}) {
1475  return &*ModulePathStringTable.insert({ModPath, {ModId, Hash}}).first;
1476  }
1477 
1478  /// Return module entry for module with the given \p ModPath.
1480  auto It = ModulePathStringTable.find(ModPath);
1481  assert(It != ModulePathStringTable.end() && "Module not registered");
1482  return &*It;
1483  }
1484 
1485  /// Check if the given Module has any functions available for exporting
1486  /// in the index. We consider any module present in the ModulePathStringTable
1487  /// to have exported functions.
1488  bool hasExportedFunctions(const Module &M) const {
1489  return ModulePathStringTable.count(M.getModuleIdentifier());
1490  }
1491 
1492  const TypeIdSummaryMapTy &typeIds() const { return TypeIdMap; }
1493 
1494  /// Return an existing or new TypeIdSummary entry for \p TypeId.
1495  /// This accessor can mutate the map and therefore should not be used in
1496  /// the ThinLTO backends.
1498  auto TidIter = TypeIdMap.equal_range(GlobalValue::getGUID(TypeId));
1499  for (auto It = TidIter.first; It != TidIter.second; ++It)
1500  if (It->second.first == TypeId)
1501  return It->second.second;
1502  auto It = TypeIdMap.insert(
1503  {GlobalValue::getGUID(TypeId), {std::string(TypeId), TypeIdSummary()}});
1504  return It->second.second;
1505  }
1506 
1507  /// This returns either a pointer to the type id summary (if present in the
1508  /// summary map) or null (if not present). This may be used when importing.
1510  auto TidIter = TypeIdMap.equal_range(GlobalValue::getGUID(TypeId));
1511  for (auto It = TidIter.first; It != TidIter.second; ++It)
1512  if (It->second.first == TypeId)
1513  return &It->second.second;
1514  return nullptr;
1515  }
1516 
1518  return const_cast<TypeIdSummary *>(
1519  static_cast<const ModuleSummaryIndex *>(this)->getTypeIdSummary(
1520  TypeId));
1521  }
1522 
1523  const auto &typeIdCompatibleVtableMap() const {
1524  return TypeIdCompatibleVtableMap;
1525  }
1526 
1527  /// Return an existing or new TypeIdCompatibleVtableMap entry for \p TypeId.
1528  /// This accessor can mutate the map and therefore should not be used in
1529  /// the ThinLTO backends.
1532  return TypeIdCompatibleVtableMap[std::string(TypeId)];
1533  }
1534 
1535  /// For the given \p TypeId, this returns the TypeIdCompatibleVtableMap
1536  /// entry if present in the summary map. This may be used when importing.
1539  auto I = TypeIdCompatibleVtableMap.find(TypeId);
1540  if (I == TypeIdCompatibleVtableMap.end())
1541  return None;
1542  return I->second;
1543  }
1544 
1545  /// Collect for the given module the list of functions it defines
1546  /// (GUID -> Summary).
1548  GVSummaryMapTy &GVSummaryMap) const;
1549 
1550  /// Collect for each module the list of Summaries it defines (GUID ->
1551  /// Summary).
1552  template <class Map>
1553  void
1554  collectDefinedGVSummariesPerModule(Map &ModuleToDefinedGVSummaries) const {
1555  for (auto &GlobalList : *this) {
1556  auto GUID = GlobalList.first;
1557  for (auto &Summary : GlobalList.second.SummaryList) {
1558  ModuleToDefinedGVSummaries[Summary->modulePath()][GUID] = Summary.get();
1559  }
1560  }
1561  }
1562 
1563  /// Print to an output stream.
1564  void print(raw_ostream &OS, bool IsForDebug = false) const;
1565 
1566  /// Dump to stderr (for debugging).
1567  void dump() const;
1568 
1569  /// Export summary to dot file for GraphViz.
1570  void
1572  const DenseSet<GlobalValue::GUID> &GUIDPreservedSymbols) const;
1573 
1574  /// Print out strongly connected components for debugging.
1575  void dumpSCCs(raw_ostream &OS);
1576 
1577  /// Do the access attribute and DSOLocal propagation in combined index.
1578  void propagateAttributes(const DenseSet<GlobalValue::GUID> &PreservedSymbols);
1579 
1580  /// Checks if we can import global variable from another module.
1581  bool canImportGlobalVar(GlobalValueSummary *S, bool AnalyzeRefs) const;
1582 };
1583 
1584 /// GraphTraits definition to build SCC for the index
1585 template <> struct GraphTraits<ValueInfo> {
1588 
1590  return P.first;
1591  }
1592  using ChildIteratorType =
1594  decltype(&valueInfoFromEdge)>;
1595 
1596  using ChildEdgeIteratorType = std::vector<FunctionSummary::EdgeTy>::iterator;
1597 
1598  static NodeRef getEntryNode(ValueInfo V) { return V; }
1599 
1601  if (!N.getSummaryList().size()) // handle external function
1602  return ChildIteratorType(
1603  FunctionSummary::ExternalNode.CallGraphEdgeList.begin(),
1604  &valueInfoFromEdge);
1605  FunctionSummary *F =
1606  cast<FunctionSummary>(N.getSummaryList().front()->getBaseObject());
1607  return ChildIteratorType(F->CallGraphEdgeList.begin(), &valueInfoFromEdge);
1608  }
1609 
1611  if (!N.getSummaryList().size()) // handle external function
1612  return ChildIteratorType(
1613  FunctionSummary::ExternalNode.CallGraphEdgeList.end(),
1614  &valueInfoFromEdge);
1615  FunctionSummary *F =
1616  cast<FunctionSummary>(N.getSummaryList().front()->getBaseObject());
1617  return ChildIteratorType(F->CallGraphEdgeList.end(), &valueInfoFromEdge);
1618  }
1619 
1621  if (!N.getSummaryList().size()) // handle external function
1622  return FunctionSummary::ExternalNode.CallGraphEdgeList.begin();
1623 
1624  FunctionSummary *F =
1625  cast<FunctionSummary>(N.getSummaryList().front()->getBaseObject());
1626  return F->CallGraphEdgeList.begin();
1627  }
1628 
1630  if (!N.getSummaryList().size()) // handle external function
1631  return FunctionSummary::ExternalNode.CallGraphEdgeList.end();
1632 
1633  FunctionSummary *F =
1634  cast<FunctionSummary>(N.getSummaryList().front()->getBaseObject());
1635  return F->CallGraphEdgeList.end();
1636  }
1637 
1638  static NodeRef edge_dest(EdgeRef E) { return E.first; }
1639 };
1640 
1641 template <>
1644  std::unique_ptr<GlobalValueSummary> Root =
1645  std::make_unique<FunctionSummary>(I->calculateCallGraphRoot());
1646  GlobalValueSummaryInfo G(I->haveGVs());
1647  G.SummaryList.push_back(std::move(Root));
1648  static auto P =
1649  GlobalValueSummaryMapTy::value_type(GlobalValue::GUID(0), std::move(G));
1650  return ValueInfo(I->haveGVs(), &P);
1651  }
1652 };
1653 } // end namespace llvm
1654 
1655 #endif // LLVM_IR_MODULESUMMARYINDEX_H
llvm::FunctionSummary::TypeIdInfo
All type identifier related information.
Definition: ModuleSummaryIndex.h:544
llvm::WholeProgramDevirtResolution::ResByArg
std::map< std::vector< uint64_t >, ByArg > ResByArg
Resolutions for calls with all constant integer arguments (excluding the first argument,...
Definition: ModuleSummaryIndex.h:1021
llvm::GlobalValue::GUID
uint64_t GUID
Declare a type to represent a global unique identifier for a global value.
Definition: GlobalValue.h:509
llvm::ValueInfo::ValueInfo
ValueInfo(bool HaveGVs, const GlobalValueSummaryMapTy::value_type *R)
Definition: ModuleSummaryIndex.h:174
llvm::FunctionSummary::ParamAccess::ParamNo
uint64_t ParamNo
Definition: ModuleSummaryIndex.h:638
llvm::const_gvsummary_iterator
GlobalValueSummaryMapTy::const_iterator const_gvsummary_iterator
Type used for iterating through the global value summary map.
Definition: ModuleSummaryIndex.h:1036
llvm::FunctionSummary::FFlags::ReadOnly
unsigned ReadOnly
Definition: ModuleSummaryIndex.h:567
llvm::ValueInfo::getSummaryList
ArrayRef< std::unique_ptr< GlobalValueSummary > > getSummaryList() const
Definition: ModuleSummaryIndex.h:187
llvm::ModuleSummaryIndex::addGlobalValueSummary
void addGlobalValueSummary(StringRef ValueName, std::unique_ptr< GlobalValueSummary > Summary)
Add a global value summary for a value of the given name.
Definition: ModuleSummaryIndex.h:1361
llvm::ModuleSummaryIndex::hasSyntheticEntryCounts
bool hasSyntheticEntryCounts() const
Definition: ModuleSummaryIndex.h:1281
llvm::ModuleSummaryIndex::haveGVs
bool haveGVs() const
Definition: ModuleSummaryIndex.h:1181
llvm::DenseMapInfo< FunctionSummary::VFuncId >::isEqual
static bool isEqual(FunctionSummary::VFuncId L, FunctionSummary::VFuncId R)
Definition: ModuleSummaryIndex.h:836
MathExtras.h
llvm::GlobalValueSummaryInfo::NameOrGV::GV
const GlobalValue * GV
The GlobalValue corresponding to this summary.
Definition: ModuleSummaryIndex.h:139
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::FunctionSummary::ConstVCall::Args
std::vector< uint64_t > Args
Definition: ModuleSummaryIndex.h:539
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
llvm::ModuleSummaryIndex::getOrInsertValueInfo
ValueInfo getOrInsertValueInfo(GlobalValue::GUID GUID, StringRef Name)
Return a ValueInfo for GUID setting value Name.
Definition: ModuleSummaryIndex.h:1327
llvm::DenseMapInfo< ValueInfo >::getEmptyKey
static ValueInfo getEmptyKey()
Definition: ModuleSummaryIndex.h:267
llvm::StringMapEntry
StringMapEntry - This is used to represent one value that is inserted into a StringMap.
Definition: StringMapEntry.h:98
llvm::ModuleSummaryIndex::getTypeIdSummary
TypeIdSummary * getTypeIdSummary(StringRef TypeId)
Definition: ModuleSummaryIndex.h:1517
llvm::WholeProgramDevirtResolution::ByArg::TheKind
enum llvm::WholeProgramDevirtResolution::ByArg::Kind TheKind
llvm::GraphTraits< ValueInfo >::edge_dest
static NodeRef edge_dest(EdgeRef E)
Definition: ModuleSummaryIndex.h:1638
llvm::GlobalValueSummary::setNotEligibleToImport
void setNotEligibleToImport()
Flag that this global value cannot be imported.
Definition: ModuleSummaryIndex.h:435
llvm::GraphTraits< ValueInfo >::getEntryNode
static NodeRef getEntryNode(ValueInfo V)
Definition: ModuleSummaryIndex.h:1598
llvm::GlobalValueSummary::setModulePath
void setModulePath(StringRef ModPath)
Set the path to the module containing this function, for use in the combined index.
Definition: ModuleSummaryIndex.h:393
llvm::GraphTraits< ValueInfo >::child_begin
static ChildIteratorType child_begin(NodeRef N)
Definition: ModuleSummaryIndex.h:1600
llvm::ModuleSummaryIndex::begin
const_gvsummary_iterator begin() const
Definition: ModuleSummaryIndex.h:1191
llvm::ModuleSummaryIndex::getModule
ModuleInfo * getModule(StringRef ModPath)
Return module entry for module with the given ModPath.
Definition: ModuleSummaryIndex.h:1479
llvm::ModuleSummaryIndex::ModuleInfo
ModulePathStringTableTy::value_type ModuleInfo
Definition: ModuleSummaryIndex.h:1469
llvm::GlobalValueSummaryMapTy
std::map< GlobalValue::GUID, GlobalValueSummaryInfo > GlobalValueSummaryMapTy
Map from global value GUID to corresponding summary structures.
Definition: ModuleSummaryIndex.h:164
llvm::DenseMapInfo< ValueInfo >::isEqual
static bool isEqual(ValueInfo L, ValueInfo R)
Definition: ModuleSummaryIndex.h:279
llvm::ModuleSummaryIndex::setPartiallySplitLTOUnits
void setPartiallySplitLTOUnits()
Definition: ModuleSummaryIndex.h:1295
llvm::ModuleSummaryIndex::isReadOnly
bool isReadOnly(const GlobalVarSummary *GVS) const
Definition: ModuleSummaryIndex.h:1274
llvm::FunctionSummary::classof
static bool classof(const GlobalValueSummary *GVS)
Check if this is a function summary.
Definition: ModuleSummaryIndex.h:728
llvm::ModuleSummaryIndex::getModuleHash
const ModuleHash & getModuleHash(const StringRef ModPath) const
Get the module SHA1 hash recorded for the given module path.
Definition: ModuleSummaryIndex.h:1444
llvm::FunctionSummary::calls
ArrayRef< EdgeTy > calls() const
Return the list of <CalleeValueInfo, CalleeInfo> pairs.
Definition: ModuleSummaryIndex.h:749
llvm::ModuleSummaryIndex::setEnableSplitLTOUnit
void setEnableSplitLTOUnit()
Definition: ModuleSummaryIndex.h:1292
llvm::CalleeInfo::MaxRelBlockFreq
static constexpr uint64_t MaxRelBlockFreq
Definition: ModuleSummaryIndex.h:74
llvm::ModuleSummaryIndex::saveString
StringRef saveString(StringRef String)
Definition: ModuleSummaryIndex.h:1324
llvm::TypeTestResolution::Kind
Kind
Specifies which kind of type check we should emit for this byte array.
Definition: ModuleSummaryIndex.h:961
llvm::FunctionSummary::fflags
FFlags fflags() const
Get function summary flags.
Definition: ModuleSummaryIndex.h:733
llvm::FunctionSummary::paramAccesses
ArrayRef< ParamAccess > paramAccesses() const
Returns the list of known uses of pointer parameters.
Definition: ModuleSummaryIndex.h:800
StringRef.h
P
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
Definition: README-SSE.txt:411
llvm::GlobalVarSummary
Global variable summary information to aid decisions and implementation of importing.
Definition: ModuleSummaryIndex.h:884
llvm::FunctionSummary::FFlags::AlwaysInline
unsigned AlwaysInline
Definition: ModuleSummaryIndex.h:574
llvm::raw_string_ostream
A raw_ostream that writes to an std::string.
Definition: raw_ostream.h:625
llvm::GlobalVarSummary::setWriteOnly
void setWriteOnly(bool WO)
Definition: ModuleSummaryIndex.h:933
llvm::FunctionSummary::ParamAccess::Call::Offsets
ConstantRange Offsets
Definition: ModuleSummaryIndex.h:631
llvm::GraphTraits< ValueInfo >::child_edge_end
static ChildEdgeIteratorType child_edge_end(NodeRef N)
Definition: ModuleSummaryIndex.h:1629
llvm::GlobalValueSummary::setLive
void setLive(bool Live)
Definition: ModuleSummaryIndex.h:417
llvm::GraphTraits< ValueInfo >::ChildEdgeIteratorType
std::vector< FunctionSummary::EdgeTy >::iterator ChildEdgeIteratorType
Definition: ModuleSummaryIndex.h:1596
llvm::ValueInfo::getGUID
GlobalValue::GUID getGUID() const
Definition: ModuleSummaryIndex.h:181
llvm::FunctionSummary::ParamAccess::ParamAccess
ParamAccess()=default
llvm::GlobalValueSummary::isDSOLocal
bool isDSOLocal() const
Definition: ModuleSummaryIndex.h:421
llvm::ValueInfo::HaveGV
@ HaveGV
Definition: ModuleSummaryIndex.h:169
llvm::GlobalValueSummary::notEligibleToImport
bool notEligibleToImport() const
Return true if this global value can't be imported.
Definition: ModuleSummaryIndex.h:413
llvm::TypeTestResolution::InlineBits
uint64_t InlineBits
Definition: ModuleSummaryIndex.h:984
llvm::Value::hasName
bool hasName() const
Definition: Value.h:261
llvm::TypeTestResolution::Unsat
@ Unsat
Unsatisfiable type (i.e. no global has this type metadata)
Definition: ModuleSummaryIndex.h:962
llvm::CalleeInfo::HotnessType::Cold
@ Cold
Allocator.h
llvm::ModuleSummaryIndex::end
const_gvsummary_iterator end() const
Definition: ModuleSummaryIndex.h:1193
llvm::FunctionSummary::setNoUnwind
void setNoUnwind()
Definition: ModuleSummaryIndex.h:737
llvm::GlobalVarSummary::GlobalVarSummary
GlobalVarSummary(GVFlags Flags, GVarFlags VarFlags, std::vector< ValueInfo > Refs)
Definition: ModuleSummaryIndex.h:921
llvm::ModuleSummaryIndex::getOrInsertTypeIdSummary
TypeIdSummary & getOrInsertTypeIdSummary(StringRef TypeId)
Return an existing or new TypeIdSummary entry for TypeId.
Definition: ModuleSummaryIndex.h:1497
llvm::FunctionSummary::addCall
void addCall(EdgeTy E)
Definition: ModuleSummaryIndex.h:753
llvm::AliasSummary
Alias summary information.
Definition: ModuleSummaryIndex.h:449
llvm::GlobalValueSummaryInfo::SummaryList
GlobalValueSummaryList SummaryList
List of global value summary structures for a particular value held in the GlobalValueMap.
Definition: ModuleSummaryIndex.h:154
llvm::TypeTestResolution::AllOnes
@ AllOnes
All-ones bit vector ("Eliminating Bit Vector Checks for All-Ones Bit Vectors")
Definition: ModuleSummaryIndex.h:966
llvm::VirtFuncOffset
The ValueInfo and offset for a function within a vtable definition initializer array.
Definition: ModuleSummaryIndex.h:865
llvm::ValueInfo::getValue
const GlobalValue * getValue() const
Definition: ModuleSummaryIndex.h:182
llvm::StringMap::end
iterator end()
Definition: StringMap.h:203
llvm::FunctionSummary::type_test_assume_const_vcalls
ArrayRef< ConstVCall > type_test_assume_const_vcalls() const
Returns the list of virtual calls made by this function using llvm.assume(llvm.type....
Definition: ModuleSummaryIndex.h:785
llvm::VirtFuncOffset::VTableOffset
uint64_t VTableOffset
Definition: ModuleSummaryIndex.h:870
DenseMap.h
llvm::FunctionSummary::FFlags::operator&=
FFlags & operator&=(const FFlags &RHS)
Definition: ModuleSummaryIndex.h:584
Module.h
llvm::GlobalValueSummary::setVisibility
void setVisibility(GlobalValue::VisibilityTypes Vis)
Definition: ModuleSummaryIndex.h:430
llvm::TypeIdOffsetVtableInfo
The following data structures summarize type metadata information.
Definition: ModuleSummaryIndex.h:1063
llvm::GlobalValueSummary::GVFlags::Linkage
unsigned Linkage
The linkage type of the associated global value.
Definition: ModuleSummaryIndex.h:304
llvm::operator!=
bool operator!=(uint64_t V1, const APInt &V2)
Definition: APInt.h:1983
llvm::Optional
Definition: APInt.h:33
llvm::VirtFuncOffset::VirtFuncOffset
VirtFuncOffset(ValueInfo VI, uint64_t Offset)
Definition: ModuleSummaryIndex.h:866
llvm::GlobalVarSummary::getVCallVisibility
GlobalObject::VCallVisibility getVCallVisibility() const
Definition: ModuleSummaryIndex.h:940
llvm::GlobalValueSummary::isLive
bool isLive() const
Definition: ModuleSummaryIndex.h:415
llvm::GlobalValue::DefaultVisibility
@ DefaultVisibility
The GV is visible.
Definition: GlobalValue.h:63
llvm::mapped_iterator
Definition: STLExtras.h:277
llvm::ModuleSummaryIndex::getTypeIdSummary
const TypeIdSummary * getTypeIdSummary(StringRef TypeId) const
This returns either a pointer to the type id summary (if present in the summary map) or null (if not ...
Definition: ModuleSummaryIndex.h:1509
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:81
llvm::FunctionSummary::FSHT_AllNonCritical
@ FSHT_AllNonCritical
Definition: ModuleSummaryIndex.h:521
llvm::ModuleSummaryIndex::isGlobalValueLive
bool isGlobalValueLive(const GlobalValueSummary *GVS) const
Definition: ModuleSummaryIndex.h:1299
llvm::FunctionSummary::TypeIdInfo::TypeTestAssumeConstVCalls
std::vector< ConstVCall > TypeTestAssumeConstVCalls
List of virtual calls made by this function using (respectively) llvm.assume(llvm....
Definition: ModuleSummaryIndex.h:558
llvm::FunctionSummary::FFlags::ReturnDoesNotAlias
unsigned ReturnDoesNotAlias
Definition: ModuleSummaryIndex.h:569
llvm::AliasSummary::setAliasee
void setAliasee(ValueInfo &AliaseeVI, GlobalValueSummary *Aliasee)
Definition: ModuleSummaryIndex.h:468
llvm::FunctionSummary::FFlags::NoInline
unsigned NoInline
Definition: ModuleSummaryIndex.h:572
STLExtras.h
llvm::ValueInfo::Flags
Flags
Definition: ModuleSummaryIndex.h:169
llvm::GlobalValueSummary::GVFlags::NotEligibleToImport
unsigned NotEligibleToImport
Indicate if the global value cannot be imported (e.g.
Definition: ModuleSummaryIndex.h:311
llvm::FunctionSummary::FFlags::NoRecurse
unsigned NoRecurse
Definition: ModuleSummaryIndex.h:568
llvm::ModuleSummaryIndex::getOriginalNameBeforePromote
static StringRef getOriginalNameBeforePromote(StringRef Name)
Helper to obtain the unpromoted name for a global value (or the original name if not promoted).
Definition: ModuleSummaryIndex.h:1464
llvm::GlobalValue::LinkageTypes
LinkageTypes
An enumeration for the kinds of linkage for global values.
Definition: GlobalValue.h:47
llvm::StringMap::find
iterator find(StringRef Key)
Definition: StringMap.h:216
llvm::FunctionSummary::ParamAccess::Call::Call
Call()=default
llvm::ModuleSummaryIndex::hasParamAccess
bool hasParamAccess() const
Definition: ModuleSummaryIndex.h:1297
llvm::yaml::MappingTraits
Definition: ModuleSummaryIndex.h:52
llvm::ModuleSummaryIndex::propagateAttributes
void propagateAttributes(const DenseSet< GlobalValue::GUID > &PreservedSymbols)
Do the access attribute and DSOLocal propagation in combined index.
Definition: ModuleSummaryIndex.cpp:245
llvm::ModuleSummaryIndex::end
gvsummary_iterator end()
Definition: ModuleSummaryIndex.h:1192
llvm::FunctionSummary::VFuncId::Offset
uint64_t Offset
Definition: ModuleSummaryIndex.h:531
llvm::AliasSummary::getAliasee
const GlobalValueSummary & getAliasee() const
Definition: ModuleSummaryIndex.h:480
llvm::ModuleSummaryIndex::getModuleId
uint64_t getModuleId(const StringRef ModPath) const
Get the module ID recorded for the given module path.
Definition: ModuleSummaryIndex.h:1439
llvm::GlobalValueSummary::getVisibility
GlobalValue::VisibilityTypes getVisibility() const
Definition: ModuleSummaryIndex.h:427
llvm::ValueInfo::isDSOLocal
bool isDSOLocal(bool WithDSOLocalPropagation=false) const
Checks if all summaries are DSO local (have the flag set).
Definition: ModuleSummaryIndex.cpp:55
llvm::GraphTraits< ValueInfo >::NodeRef
ValueInfo NodeRef
Definition: ModuleSummaryIndex.h:1586
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::GlobalValueSummary::refs
ArrayRef< ValueInfo > refs() const
Return the list of values referenced by this global value definition.
Definition: ModuleSummaryIndex.h:438
llvm::ModuleSummaryIndex::withDSOLocalPropagation
bool withDSOLocalPropagation() const
Definition: ModuleSummaryIndex.h:1271
llvm::GlobalValueSummary::GVFlags
Group flags (Linkage, NotEligibleToImport, etc.) as a bitfield.
Definition: ModuleSummaryIndex.h:296
llvm::FunctionSummary::TypeIdInfo::TypeCheckedLoadVCalls
std::vector< VFuncId > TypeCheckedLoadVCalls
Definition: ModuleSummaryIndex.h:553
llvm::ValueInfo::WriteOnly
@ WriteOnly
Definition: ModuleSummaryIndex.h:169
llvm::VirtFuncOffset::FuncVI
ValueInfo FuncVI
Definition: ModuleSummaryIndex.h:869
llvm::FunctionSummary::ConstVCall
A specification for a virtual function call with all constant integer arguments.
Definition: ModuleSummaryIndex.h:537
llvm::ModuleSummaryIndex::size
size_t size() const
Definition: ModuleSummaryIndex.h:1194
llvm::ValueInfo::ValueInfo
ValueInfo()=default
llvm::ModuleSummaryIndex::setWithAttributePropagation
void setWithAttributePropagation()
Definition: ModuleSummaryIndex.h:1267
llvm::GlobalValueSummary
Function and variable summary information to aid decisions and implementation of importing.
Definition: ModuleSummaryIndex.h:290
llvm::DenseMapInfo
Definition: APInt.h:34
llvm::GlobalVarSummary::GVarFlags::MaybeWriteOnly
unsigned MaybeWriteOnly
Definition: ModuleSummaryIndex.h:906
llvm::ValueInfo::name
StringRef name() const
Definition: ModuleSummaryIndex.h:191
llvm::GlobalValueSummaryInfo
Definition: ModuleSummaryIndex.h:126
GlobalValue.h
llvm::TypeIdOffsetVtableInfo::VTableVI
ValueInfo VTableVI
Definition: ModuleSummaryIndex.h:1068
llvm::GlobalValue::VisibilityTypes
VisibilityTypes
An enumeration for the kinds of visibility of global values.
Definition: GlobalValue.h:62
llvm::GlobalVarSummary::GVarFlags
Definition: ModuleSummaryIndex.h:891
llvm::FunctionSummary::EdgeTy
std::pair< ValueInfo, CalleeInfo > EdgeTy
<CalleeValueInfo, CalleeInfo> call edge pair.
Definition: ModuleSummaryIndex.h:516
llvm::FunctionSummary::ParamAccess::Call::Callee
ValueInfo Callee
Definition: ModuleSummaryIndex.h:630
llvm::GlobalVarSummary::GVarFlags::VCallVisibility
unsigned VCallVisibility
Definition: ModuleSummaryIndex.h:918
SmallString.h
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::ModuleSummaryIndex::enableSplitLTOUnit
bool enableSplitLTOUnit() const
Definition: ModuleSummaryIndex.h:1291
llvm::ValueInfo::isWriteOnly
bool isWriteOnly() const
Definition: ModuleSummaryIndex.h:201
llvm::GlobalValueSummary::setCanAutoHide
void setCanAutoHide(bool CanAutoHide)
Definition: ModuleSummaryIndex.h:423
llvm::yaml::MappingTraits< ModuleSummaryIndex >
Definition: ModuleSummaryIndexYAML.h:278
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::GlobalValueSummaryInfo::NameOrGV
Definition: ModuleSummaryIndex.h:127
llvm::FunctionSummary::ParamAccess::Call::ParamNo
uint64_t ParamNo
Definition: ModuleSummaryIndex.h:629
llvm::StringMap::insert
bool insert(MapEntryTy *KeyValue)
insert - Insert the specified key/value pair into the map.
Definition: StringMap.h:274
llvm::FunctionSummary::type_tests
ArrayRef< GlobalValue::GUID > type_tests() const
Returns the list of type identifiers used by this function in llvm.type.test intrinsics other than by...
Definition: ModuleSummaryIndex.h:758
llvm::FunctionSummary::type_test_assume_vcalls
ArrayRef< VFuncId > type_test_assume_vcalls() const
Returns the list of virtual calls made by this function using llvm.assume(llvm.type....
Definition: ModuleSummaryIndex.h:767
llvm::WholeProgramDevirtResolution::ByArg::Kind
Kind
Definition: ModuleSummaryIndex.h:999
llvm::FunctionSummary::ForceSummaryHotnessType
ForceSummaryHotnessType
Types for -force-summary-edges-cold debugging option.
Definition: ModuleSummaryIndex.h:519
llvm::GlobalValueSummaryInfo::U
union llvm::GlobalValueSummaryInfo::NameOrGV U
llvm::GlobalValueSummary::GlobalVarKind
@ GlobalVarKind
Definition: ModuleSummaryIndex.h:293
llvm::GlobalValueSummary::flags
GVFlags flags() const
Get the flags for this GlobalValue (see struct GVFlags).
Definition: ModuleSummaryIndex.h:399
llvm::CalleeInfo::HotnessType
HotnessType
Definition: ModuleSummaryIndex.h:58
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::ModuleSummaryIndex::modulePaths
StringMap< std::pair< uint64_t, ModuleHash > > & modulePaths()
Table of modules, containing hash and id.
Definition: ModuleSummaryIndex.h:1434
llvm::WholeProgramDevirtResolution::ByArg::Byte
uint32_t Byte
Definition: ModuleSummaryIndex.h:1015
llvm::X86AS::FS
@ FS
Definition: X86.h:188
llvm::GlobalVarSummary::isConstant
bool isConstant() const
Definition: ModuleSummaryIndex.h:936
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
llvm::FunctionSummary::mutableCalls
std::vector< EdgeTy > & mutableCalls()
Definition: ModuleSummaryIndex.h:751
llvm::operator<<
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
Definition: APFixedPoint.h:230
llvm::GlobalValueSummary::getSummaryKind
SummaryKind getSummaryKind() const
Which kind of summary subclass this is.
Definition: ModuleSummaryIndex.h:389
llvm::FunctionSummary::ParamAccess::ParamAccess
ParamAccess(uint64_t ParamNo, const ConstantRange &Use)
Definition: ModuleSummaryIndex.h:651
llvm::getHotnessName
const char * getHotnessName(CalleeInfo::HotnessType HT)
Definition: ModuleSummaryIndex.h:106
llvm::GlobalVarSummary::maybeReadOnly
bool maybeReadOnly() const
Definition: ModuleSummaryIndex.h:934
llvm::ModuleSummaryIndex::addOriginalName
void addOriginalName(GlobalValue::GUID ValueGUID, GlobalValue::GUID OrigGUID)
Add an original name for the value of the given GUID.
Definition: ModuleSummaryIndex.h:1380
llvm::ModuleSummaryIndex::hasExportedFunctions
bool hasExportedFunctions(const Module &M) const
Check if the given Module has any functions available for exporting in the index.
Definition: ModuleSummaryIndex.h:1488
llvm::ModuleSummaryIndex::getFlags
uint64_t getFlags() const
Definition: ModuleSummaryIndex.cpp:93
llvm::CalleeInfo::updateRelBlockFreq
void updateRelBlockFreq(uint64_t BlockFreq, uint64_t EntryFreq)
Update RelBlockFreq from BlockFreq and EntryFreq.
Definition: ModuleSummaryIndex.h:92
llvm::ModuleSummaryIndex::findSummaryInModule
GlobalValueSummary * findSummaryInModule(ValueInfo VI, StringRef ModuleId) const
Find the summary for ValueInfo VI in module ModuleId, or nullptr if not found.
Definition: ModuleSummaryIndex.h:1392
StringMap.h
llvm::ModuleSummaryIndex::withGlobalValueDeadStripping
bool withGlobalValueDeadStripping() const
Definition: ModuleSummaryIndex.h:1259
llvm::WholeProgramDevirtResolution::Kind
Kind
Definition: ModuleSummaryIndex.h:988
llvm::WholeProgramDevirtResolution::BranchFunnel
@ BranchFunnel
When retpoline mitigation is enabled, use a branch funnel that is defined in the merged module.
Definition: ModuleSummaryIndex.h:991
llvm::ValueInfo::ReadOnly
@ ReadOnly
Definition: ModuleSummaryIndex.h:169
llvm::FunctionSummary::FFlags::anyFlagSet
bool anyFlagSet()
Definition: ModuleSummaryIndex.h:597
llvm::TypeTestResolution::BitMask
uint8_t BitMask
Definition: ModuleSummaryIndex.h:983
llvm::TypeTestResolution::Inline
@ Inline
Inlined bit vector ("Short Inline Bit Vectors")
Definition: ModuleSummaryIndex.h:964
llvm::None
const NoneType None
Definition: None.h:23
llvm::ValueInfo::getELFVisibility
GlobalValue::VisibilityTypes getELFVisibility() const
Returns the most constraining visibility among summaries.
Definition: ModuleSummaryIndex.cpp:43
llvm::GlobalValueSummary::GVFlags::Visibility
unsigned Visibility
Indicates the visibility.
Definition: ModuleSummaryIndex.h:307
llvm::GlobalValue::getGUID
static GUID getGUID(StringRef GlobalName)
Return a 64-bit global unique ID constructed from global value name (i.e.
Definition: GlobalValue.h:513
llvm::FunctionSummary::addTypeTest
void addTypeTest(GlobalValue::GUID Guid)
Add a type test to the summary.
Definition: ModuleSummaryIndex.h:818
llvm::ModuleSummaryIndex::setHasSyntheticEntryCounts
void setHasSyntheticEntryCounts()
Definition: ModuleSummaryIndex.h:1282
llvm::CalleeInfo
Class to accumulate and hold information about a callee.
Definition: ModuleSummaryIndex.h:57
llvm::WholeProgramDevirtResolution::SingleImpl
@ SingleImpl
Single implementation devirtualization.
Definition: ModuleSummaryIndex.h:990
llvm::StringMap< std::pair< uint64_t, ModuleHash > >
llvm::ValueInfo
Struct that holds a reference to a particular GUID in a global value summary.
Definition: ModuleSummaryIndex.h:168
llvm::SmallString< 256 >
llvm::CalleeInfo::HotnessType::None
@ None
llvm::ValueInfo::setReadOnly
void setReadOnly()
Definition: ModuleSummaryIndex.h:213
llvm::FunctionSummary::FFlags::HasUnknownCall
unsigned HasUnknownCall
Definition: ModuleSummaryIndex.h:582
llvm::ValueInfo::canAutoHide
bool canAutoHide() const
Checks if all copies are eligible for auto-hiding (have flag set).
Definition: ModuleSummaryIndex.cpp:68
llvm::TypeTestResolution::AlignLog2
uint64_t AlignLog2
Definition: ModuleSummaryIndex.h:981
llvm::GlobalVarSummary::setVCallVisibility
void setVCallVisibility(GlobalObject::VCallVisibility Vis)
Definition: ModuleSummaryIndex.h:937
llvm::WholeProgramDevirtResolution::SingleImplName
std::string SingleImplName
Definition: ModuleSummaryIndex.h:996
llvm::AliasSummary::hasAliasee
bool hasAliasee() const
Definition: ModuleSummaryIndex.h:473
StringSaver.h
llvm::ModuleSummaryIndex::findSummaryInModule
GlobalValueSummary * findSummaryInModule(GlobalValue::GUID ValueGUID, StringRef ModuleId) const
Find the summary for global GUID in module ModuleId, or nullptr if not found.
Definition: ModuleSummaryIndex.h:1406
llvm::GlobalVarSummary::maybeWriteOnly
bool maybeWriteOnly() const
Definition: ModuleSummaryIndex.h:935
llvm::TypeTestResolution::Single
@ Single
Single element (last example in "Short Inline Bit Vectors")
Definition: ModuleSummaryIndex.h:965
llvm::WholeProgramDevirtResolution::ByArg::UniformRetVal
@ UniformRetVal
Uniform return value optimization.
Definition: ModuleSummaryIndex.h:1001
llvm::PointerIntPair::getPointer
PointerTy getPointer() const
Definition: PointerIntPair.h:59
G
const DataFlowGraph & G
Definition: RDFGraph.cpp:202
llvm::DenseSet
Implements a dense probed hash-table based set.
Definition: DenseSet.h:268
llvm::ModuleSummaryIndex::isGUIDLive
bool isGUIDLive(GlobalValue::GUID GUID) const
Definition: ModuleSummaryIndex.cpp:175
llvm::FunctionSummary::VFuncId
An "identifier" for a virtual function.
Definition: ModuleSummaryIndex.h:529
llvm::CalleeInfo::HotnessType::Hot
@ Hot
llvm::GlobalValue
Definition: GlobalValue.h:44
VI
@ VI
Definition: SIInstrInfo.cpp:7689
llvm::WholeProgramDevirtResolution::ByArg::Indir
@ Indir
Just do a regular virtual call.
Definition: ModuleSummaryIndex.h:1000
llvm::Constant
This is an important base class in LLVM.
Definition: Constant.h:41
llvm::GlobalValueSummary::linkage
GlobalValue::LinkageTypes linkage() const
Return linkage type recorded for this global value.
Definition: ModuleSummaryIndex.h:402
llvm::GlobalVarSummary::vTableFuncs
ArrayRef< VirtFuncOffset > vTableFuncs() const
Definition: ModuleSummaryIndex.h:949
llvm::GlobalValueSummary::GVFlags::GVFlags
GVFlags(GlobalValue::LinkageTypes Linkage, GlobalValue::VisibilityTypes Visibility, bool NotEligibleToImport, bool Live, bool IsLocal, bool CanAutoHide)
Convenience Constructors.
Definition: ModuleSummaryIndex.h:336
llvm::WholeProgramDevirtResolution::Indir
@ Indir
Just do a regular virtual call.
Definition: ModuleSummaryIndex.h:989
llvm::ValueInfo::getAccessSpecifier
unsigned getAccessSpecifier() const
Definition: ModuleSummaryIndex.h:205
uint64_t
llvm::ModuleSummaryIndex::dumpSCCs
void dumpSCCs(raw_ostream &OS)
Print out strongly connected components for debugging.
Definition: ModuleSummaryIndex.cpp:350
llvm::BumpPtrAllocatorImpl
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:67
llvm::ModuleSummaryIndex::getValueInfo
ValueInfo getValueInfo(const GlobalValueSummaryMapTy::value_type &R) const
Return a ValueInfo for the index value_type (convenient when iterating index).
Definition: ModuleSummaryIndex.h:1306
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::ModuleSummaryIndex::getGUIDFromOriginalID
GlobalValue::GUID getGUIDFromOriginalID(GlobalValue::GUID OriginalID) const
Return the GUID for OriginalId in the OidGuidMap.
Definition: ModuleSummaryIndex.h:1343
llvm::DenseMap
Definition: DenseMap.h:714
llvm::ModuleSummaryIndex::getBlockCount
uint64_t getBlockCount() const
Definition: ModuleSummaryIndex.h:1186
llvm::AliasSummary::AliasSummary
AliasSummary(GVFlags Flags)
Definition: ModuleSummaryIndex.h:459
llvm::operator<
bool operator<(int64_t V1, const APSInt &V2)
Definition: APSInt.h:338
llvm::VTableFuncList
std::vector< VirtFuncOffset > VTableFuncList
List of functions referenced by a particular vtable definition.
Definition: ModuleSummaryIndex.h:873
llvm::DenseMapInfo< FunctionSummary::ConstVCall >::getTombstoneKey
static FunctionSummary::ConstVCall getTombstoneKey()
Definition: ModuleSummaryIndex.h:848
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::StringMap::lookup
ValueTy lookup(StringRef Key) const
lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...
Definition: StringMap.h:232
llvm::PointerIntPair::getInt
IntType getInt() const
Definition: PointerIntPair.h:61
StringExtras.h
llvm::GraphTraits< ValueInfo >::child_end
static ChildIteratorType child_end(NodeRef N)
Definition: ModuleSummaryIndex.h:1610
llvm::ModuleSummaryIndex::setBlockCount
void setBlockCount(uint64_t C)
Definition: ModuleSummaryIndex.h:1188
llvm::GraphTraits< ModuleSummaryIndex * >::getEntryNode
static NodeRef getEntryNode(ModuleSummaryIndex *I)
Definition: ModuleSummaryIndex.h:1643
llvm::ModuleSummaryIndex::print
void print(raw_ostream &OS, bool IsForDebug=false) const
Print to an output stream.
Definition: AsmWriter.cpp:4816
llvm::ModuleSummaryIndex::getTypeIdCompatibleVtableSummary
Optional< TypeIdCompatibleVtableInfo > getTypeIdCompatibleVtableSummary(StringRef TypeId) const
For the given TypeId, this returns the TypeIdCompatibleVtableMap entry if present in the summary map.
Definition: ModuleSummaryIndex.h:1538
llvm::ModuleSummaryIndex::skipModuleByDistributedBackend
bool skipModuleByDistributedBackend() const
Definition: ModuleSummaryIndex.h:1284
llvm::FunctionSummary::makeDummyFunctionSummary
static FunctionSummary makeDummyFunctionSummary(std::vector< FunctionSummary::EdgeTy > Edges)
Create an empty FunctionSummary (with specified call edges).
Definition: ModuleSummaryIndex.h:658
llvm::WholeProgramDevirtResolution::ByArg::UniqueRetVal
@ UniqueRetVal
Unique return value optimization.
Definition: ModuleSummaryIndex.h:1002
ArrayRef.h
llvm::gvsummary_iterator
GlobalValueSummaryMapTy::iterator gvsummary_iterator
Definition: ModuleSummaryIndex.h:1037
llvm::TypeIdSummary
Definition: ModuleSummaryIndex.h:1024
llvm::TypeIdOffsetVtableInfo::TypeIdOffsetVtableInfo
TypeIdOffsetVtableInfo(uint64_t Offset, ValueInfo VI)
Definition: ModuleSummaryIndex.h:1064
llvm::ModuleSummaryIndex::modulePaths
const StringMap< std::pair< uint64_t, ModuleHash > > & modulePaths() const
Table of modules, containing module hash and id.
Definition: ModuleSummaryIndex.h:1429
llvm::ModuleSummaryIndex::addBlockCount
void addBlockCount(uint64_t C)
Definition: ModuleSummaryIndex.h:1187
llvm::CalleeInfo::Hotness
uint32_t Hotness
Definition: ModuleSummaryIndex.h:68
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::move
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1609
llvm::GlobalValueSummary::FunctionKind
@ FunctionKind
Definition: ModuleSummaryIndex.h:293
llvm::ModuleSummaryIndex::getOrInsertValueInfo
ValueInfo getOrInsertValueInfo(GlobalValue::GUID GUID)
Return a ValueInfo for GUID.
Definition: ModuleSummaryIndex.h:1317
llvm::operator==
bool operator==(uint64_t V1, const APInt &V2)
Definition: APInt.h:1981
llvm::ModuleSummaryIndex::typeIds
const TypeIdSummaryMapTy & typeIds() const
Definition: ModuleSummaryIndex.h:1492
llvm::ModuleSummaryIndex::setWithDSOLocalPropagation
void setWithDSOLocalPropagation()
Definition: ModuleSummaryIndex.h:1272
llvm::ModuleSummaryIndex::begin
gvsummary_iterator begin()
Definition: ModuleSummaryIndex.h:1190
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
llvm::ModuleSummaryIndex::cfiFunctionDefs
std::set< std::string > & cfiFunctionDefs()
Definition: ModuleSummaryIndex.h:1348
llvm::ModuleSummaryIndex::ModuleSummaryIndex
ModuleSummaryIndex(bool HaveGVs, bool EnableSplitLTOUnit=false)
Definition: ModuleSummaryIndex.h:1165
TinyPtrVector.h
llvm::FunctionSummary::FFlags
Flags specific to function summaries.
Definition: ModuleSummaryIndex.h:563
llvm::StringSaver
Saves strings in the provided stable storage and returns a StringRef with a stable character pointer.
Definition: StringSaver.h:21
llvm::ModuleSummaryIndex::partiallySplitLTOUnits
bool partiallySplitLTOUnits() const
Definition: ModuleSummaryIndex.h:1294
llvm::DenseMapInfo< FunctionSummary::VFuncId >::getEmptyKey
static FunctionSummary::VFuncId getEmptyKey()
Definition: ModuleSummaryIndex.h:830
llvm::FunctionSummary::setParamAccesses
void setParamAccesses(std::vector< ParamAccess > NewParams)
Sets the list of known uses of pointer parameters.
Definition: ModuleSummaryIndex.h:807
llvm::FunctionSummary::instCount
unsigned instCount() const
Get the instruction count recorded for this function.
Definition: ModuleSummaryIndex.h:740
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::GlobalValueSummary::SummaryKind
SummaryKind
Sububclass discriminator (for dyn_cast<> et al.)
Definition: ModuleSummaryIndex.h:293
llvm::CalleeInfo::HotnessType::Unknown
@ Unknown
llvm::min
Expected< ExpressionValue > min(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
Definition: FileCheck.cpp:357
llvm::ModuleSummaryIndex::exportToDot
void exportToDot(raw_ostream &OS, const DenseSet< GlobalValue::GUID > &GUIDPreservedSymbols) const
Export summary to dot file for GraphViz.
Definition: ModuleSummaryIndex.cpp:525
llvm::ModuleSummaryIndex::setFlags
void setFlags(uint64_t Flags)
Definition: ModuleSummaryIndex.cpp:112
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:134
llvm::GlobalValueSummary::AliasKind
@ AliasKind
Definition: ModuleSummaryIndex.h:293
llvm::ModuleSummaryIndex::getValueInfo
ValueInfo getValueInfo(GlobalValue::GUID GUID) const
Return a ValueInfo for GUID if it exists, otherwise return ValueInfo().
Definition: ModuleSummaryIndex.h:1311
llvm::GlobalValueSummaryInfo::NameOrGV::NameOrGV
NameOrGV(bool HaveGVs)
Definition: ModuleSummaryIndex.h:128
uint32_t
llvm::ModuleSummaryIndex::collectDefinedGVSummariesPerModule
void collectDefinedGVSummariesPerModule(Map &ModuleToDefinedGVSummaries) const
Collect for each module the list of Summaries it defines (GUID -> Summary).
Definition: ModuleSummaryIndex.h:1554
llvm::ValueInfo::haveGVs
bool haveGVs() const
Definition: ModuleSummaryIndex.h:196
llvm::GlobalValueSummary::GlobalValueSummary
GlobalValueSummary(SummaryKind K, GVFlags Flags, std::vector< ValueInfo > Refs)
Definition: ModuleSummaryIndex.h:372
llvm::FunctionSummary::ParamAccess::Call::Call
Call(uint64_t ParamNo, ValueInfo Callee, const ConstantRange &Offsets)
Definition: ModuleSummaryIndex.h:634
ConstantRange.h
llvm::CalleeInfo::updateHotness
void updateHotness(const HotnessType OtherHotness)
Definition: ModuleSummaryIndex.h:81
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
llvm::AliasSummary::getAliasee
GlobalValueSummary & getAliasee()
Definition: ModuleSummaryIndex.h:485
llvm::TypeTestResolution
Definition: ModuleSummaryIndex.h:956
llvm::TypeIdCompatibleVtableInfo
std::vector< TypeIdOffsetVtableInfo > TypeIdCompatibleVtableInfo
List of vtable definitions decorated by a particular type identifier, and their corresponding offsets...
Definition: ModuleSummaryIndex.h:1074
llvm::ModuleSummaryIndex::cfiFunctionDecls
std::set< std::string > & cfiFunctionDecls()
Definition: ModuleSummaryIndex.h:1351
llvm::GlobalValueSummaryInfo::NameOrGV::Name
StringRef Name
Summary string representation.
Definition: ModuleSummaryIndex.h:146
llvm::ValueInfo::RefAndFlags
PointerIntPair< const GlobalValueSummaryMapTy::value_type *, 3, int > RefAndFlags
Definition: ModuleSummaryIndex.h:171
llvm::FunctionSummary::FSHT_None
@ FSHT_None
Definition: ModuleSummaryIndex.h:520
llvm::FunctionSummary::entryCount
uint64_t entryCount() const
Get the synthetic entry count for this function.
Definition: ModuleSummaryIndex.h:743
llvm::TypeTestResolution::TheKind
enum llvm::TypeTestResolution::Kind TheKind
llvm::TypeTestResolution::Unknown
@ Unknown
Unknown (analysis not performed, don't lower)
Definition: ModuleSummaryIndex.h:968
ScaledNumber.h
llvm::GlobalVarSummary::setVTableFuncs
void setVTableFuncs(VTableFuncList Funcs)
Definition: ModuleSummaryIndex.h:944
llvm::ValueInfo::getRef
const GlobalValueSummaryMapTy::value_type * getRef() const
Definition: ModuleSummaryIndex.h:224
llvm::find_if
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1578
llvm::ModuleSummaryIndex::canImportGlobalVar
bool canImportGlobalVar(GlobalValueSummary *S, bool AnalyzeRefs) const
Checks if we can import global variable from another module.
Definition: ModuleSummaryIndex.cpp:315
llvm::CalleeInfo::CalleeInfo
CalleeInfo()
Definition: ModuleSummaryIndex.h:76
llvm::GlobalVarSummary::GVarFlags::Constant
unsigned Constant
Definition: ModuleSummaryIndex.h:915
llvm::DenseMapInfo< FunctionSummary::VFuncId >::getHashValue
static unsigned getHashValue(FunctionSummary::VFuncId I)
Definition: ModuleSummaryIndex.h:840
llvm::PointerIntPair::setPointer
void setPointer(PointerTy PtrVal) LLVM_LVALUE_FUNCTION
Definition: PointerIntPair.h:63
llvm::GlobalValueSummaryList
std::vector< std::unique_ptr< GlobalValueSummary > > GlobalValueSummaryList
Definition: ModuleSummaryIndex.h:124
llvm::CalleeInfo::HotnessType::Critical
@ Critical
llvm::FunctionSummary::type_checked_load_vcalls
ArrayRef< VFuncId > type_checked_load_vcalls() const
Returns the list of virtual calls made by this function using llvm.type.checked.load intrinsics that ...
Definition: ModuleSummaryIndex.h:776
llvm::DenseMapInfo< ValueInfo >::getHashValue
static unsigned getHashValue(ValueInfo I)
Definition: ModuleSummaryIndex.h:285
llvm::ModuleSummaryIndex::cfiFunctionDecls
const std::set< std::string > & cfiFunctionDecls() const
Definition: ModuleSummaryIndex.h:1352
llvm::ScaledNumber< uint64_t >
llvm::DenseMapInfo< FunctionSummary::ConstVCall >::getEmptyKey
static FunctionSummary::ConstVCall getEmptyKey()
Definition: ModuleSummaryIndex.h:844
llvm::FunctionSummary::ExternalNode
static FunctionSummary ExternalNode
A dummy node to reference external functions that aren't in the index.
Definition: ModuleSummaryIndex.h:676
llvm::GlobalVarSummary::varflags
GVarFlags varflags() const
Definition: ModuleSummaryIndex.h:931
llvm::WholeProgramDevirtResolution::ByArg
Definition: ModuleSummaryIndex.h:998
llvm::FunctionSummary
Function summary information to aid decisions and implementation of importing.
Definition: ModuleSummaryIndex.h:513
llvm::TypeTestResolution::SizeM1
uint64_t SizeM1
Definition: ModuleSummaryIndex.h:982
llvm::ModuleSummaryIndex::setWithGlobalValueDeadStripping
void setWithGlobalValueDeadStripping()
Definition: ModuleSummaryIndex.h:1262
llvm::GlobalObject::VCallVisibility
VCallVisibility
Definition: GlobalObject.h:33
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
std
Definition: BitVector.h:838
llvm::AliasSummary::classof
static bool classof(const GlobalValueSummary *GVS)
Check if this is an alias summary.
Definition: ModuleSummaryIndex.h:464
llvm::FunctionSummary::ParamAccess::Calls
std::vector< Call > Calls
In the per-module summary, it summarizes the byte offset applied to each pointer parameter before pas...
Definition: ModuleSummaryIndex.h:648
llvm::FunctionSummary::ParamAccess::RangeWidth
static constexpr uint32_t RangeWidth
Definition: ModuleSummaryIndex.h:623
get
Should compile to something r4 addze r3 instead we get
Definition: README.txt:24
llvm::GlobalValueSummary::getOriginalName
GlobalValue::GUID getOriginalName() const
Returns the hash of the original name, it is identical to the GUID for externally visible symbols,...
Definition: ModuleSummaryIndex.h:383
llvm::FunctionSummary::FFlags::ReadNone
unsigned ReadNone
Definition: ModuleSummaryIndex.h:566
llvm::ModuleSummaryIndex::calculateCallGraphRoot
FunctionSummary calculateCallGraphRoot()
Definition: ModuleSummaryIndex.h:1230
llvm::ModuleSummaryIndex::cfiFunctionDefs
const std::set< std::string > & cfiFunctionDefs() const
Definition: ModuleSummaryIndex.h:1349
llvm::GlobalValue::getGUID
GUID getGUID() const
Return a 64-bit global unique ID constructed from global value name (i.e.
Definition: GlobalValue.h:517
llvm::ModuleSummaryIndex::typeIdCompatibleVtableMap
const auto & typeIdCompatibleVtableMap() const
Definition: ModuleSummaryIndex.h:1523
llvm::CalleeInfo::RelBlockFreq
uint32_t RelBlockFreq
The value stored in RelBlockFreq has to be interpreted as the digits of a scaled number with a scale ...
Definition: ModuleSummaryIndex.h:72
llvm::CalleeInfo::getHotness
HotnessType getHotness() const
Definition: ModuleSummaryIndex.h:85
llvm::DenseMapInfo< FunctionSummary::VFuncId >::getTombstoneKey
static FunctionSummary::VFuncId getTombstoneKey()
Definition: ModuleSummaryIndex.h:832
llvm::GlobalValueSummary::GVFlags::CanAutoHide
unsigned CanAutoHide
In the per-module summary, indicates that the global value is linkonce_odr and global unnamed addr (s...
Definition: ModuleSummaryIndex.h:333
llvm::WholeProgramDevirtResolution::ByArg::Info
uint64_t Info
Additional information for the resolution:
Definition: ModuleSummaryIndex.h:1010
llvm::WholeProgramDevirtResolution::ByArg::VirtualConstProp
@ VirtualConstProp
Virtual constant propagation.
Definition: ModuleSummaryIndex.h:1003
llvm::ModuleSummaryIndex::getGlobalValueSummary
GlobalValueSummary * getGlobalValueSummary(const GlobalValue &GV, bool PerModuleIndex=true) const
Returns the first GlobalValueSummary for GV, asserting that there is only one if PerModuleIndex.
Definition: ModuleSummaryIndex.h:1416
llvm::FunctionSummary::FFlags::MayThrow
unsigned MayThrow
Definition: ModuleSummaryIndex.h:579
llvm::FunctionSummary::setNoRecurse
void setNoRecurse()
Definition: ModuleSummaryIndex.h:735
llvm::GlobalVarSummary::setReadOnly
void setReadOnly(bool RO)
Definition: ModuleSummaryIndex.h:932
Scaled64
ScaledNumber< uint64_t > Scaled64
Definition: SyntheticCountsPropagation.cpp:42
llvm::FunctionSummary::specialRefCounts
std::pair< unsigned, unsigned > specialRefCounts() const
Definition: ModuleSummaryIndex.cpp:78
isEqual
static bool isEqual(const Function &Caller, const Function &Callee)
Definition: Attributes.cpp:1856
llvm::StringMap::count
size_type count(StringRef Key) const
count - Return 1 if the element is in the map, 0 otherwise.
Definition: StringMap.h:244
llvm::SmallString::str
StringRef str() const
Explicit conversion to StringRef.
Definition: SmallString.h:259
llvm::ModuleSummaryIndex::BitcodeSummaryVersion
static constexpr uint64_t BitcodeSummaryVersion
Definition: ModuleSummaryIndex.h:1174
llvm::ModuleSummaryIndex::dump
void dump() const
Dump to stderr (for debugging).
Definition: AsmWriter.cpp:4878
llvm::ConstantRange
This class represents a range of values.
Definition: ConstantRange.h:47
llvm::PointerIntPair::setInt
void setInt(IntType IntVal) LLVM_LVALUE_FUNCTION
Definition: PointerIntPair.h:67
llvm::TypeIdSummary::WPDRes
std::map< uint64_t, WholeProgramDevirtResolution > WPDRes
Mapping from byte offset to whole-program devirt resolution for that (typeid, byte offset) pair.
Definition: ModuleSummaryIndex.h:1029
llvm::WholeProgramDevirtResolution::TheKind
enum llvm::WholeProgramDevirtResolution::Kind TheKind
llvm::ModuleSummaryIndex::isWriteOnly
bool isWriteOnly(const GlobalVarSummary *GVS) const
Definition: ModuleSummaryIndex.h:1277
llvm::GlobalVarSummary::classof
static bool classof(const GlobalValueSummary *GVS)
Check if this is a global variable summary.
Definition: ModuleSummaryIndex.h:927
llvm::ModuleSummaryIndex::setSkipModuleByDistributedBackend
void setSkipModuleByDistributedBackend()
Definition: ModuleSummaryIndex.h:1287
llvm::ModuleSummaryIndex::addGlobalValueSummary
void addGlobalValueSummary(const GlobalValue &GV, std::unique_ptr< GlobalValueSummary > Summary)
Add a global value summary for a value.
Definition: ModuleSummaryIndex.h:1355
llvm::FunctionSummary::type_checked_load_const_vcalls
ArrayRef< ConstVCall > type_checked_load_const_vcalls() const
Returns the list of virtual calls made by this function using llvm.type.checked.load intrinsics with ...
Definition: ModuleSummaryIndex.h:793
llvm::GlobalValueSummary::setLinkage
void setLinkage(GlobalValue::LinkageTypes Linkage)
Sets the linkage to the value determined by global summary-based optimization.
Definition: ModuleSummaryIndex.h:408
llvm::ValueInfo::setWriteOnly
void setWriteOnly()
Definition: ModuleSummaryIndex.h:219
llvm::GraphTraits< ValueInfo >::child_edge_begin
static ChildEdgeIteratorType child_edge_begin(NodeRef N)
Definition: ModuleSummaryIndex.h:1620
llvm::GlobalValueSummary::canAutoHide
bool canAutoHide() const
Definition: ModuleSummaryIndex.h:425
llvm::PointerIntPair< const GlobalValueSummaryMapTy::value_type *, 3, int >
llvm::GraphTraits< ValueInfo >::valueInfoFromEdge
static NodeRef valueInfoFromEdge(FunctionSummary::EdgeTy &P)
Definition: ModuleSummaryIndex.h:1589
llvm::TypeIdSummary::TTRes
TypeTestResolution TTRes
Definition: ModuleSummaryIndex.h:1025
llvm::GlobalValueSummary::getBaseObject
GlobalValueSummary * getBaseObject()
If this is an alias summary, returns the summary of the aliased object (a global variable or function...
Definition: ModuleSummaryIndex.h:499
llvm::ModuleSummaryIndex
Class to hold module path string table and global value map, and encapsulate methods for operating on...
Definition: ModuleSummaryIndex.h:1078
llvm::ModuleSummaryIndex::getGlobalNameForLocal
static std::string getGlobalNameForLocal(StringRef Name, ModuleHash ModHash)
Convenience method for creating a promoted global name for the given value name of a local,...
Definition: ModuleSummaryIndex.h:1452
llvm::GlobalValueSummary::modulePath
StringRef modulePath() const
Get the path to the module containing this function.
Definition: ModuleSummaryIndex.h:396
llvm::FunctionSummary::FSHT_All
@ FSHT_All
Definition: ModuleSummaryIndex.h:522
llvm::FunctionSummary::ParamAccess
Describes the uses of a parameter by the function.
Definition: ModuleSummaryIndex.h:622
llvm::CalleeInfo::CalleeInfo
CalleeInfo(HotnessType Hotness, uint64_t RelBF)
Definition: ModuleSummaryIndex.h:78
N
#define N
llvm::ModuleSummaryIndex::getOrInsertValueInfo
ValueInfo getOrInsertValueInfo(const GlobalValue *GV)
Return a ValueInfo for GV and mark it as belonging to GV.
Definition: ModuleSummaryIndex.h:1335
llvm::max
Align max(MaybeAlign Lhs, Align Rhs)
Definition: Alignment.h:340
llvm::StringSaver::save
StringRef save(const char *S)
Definition: StringSaver.h:28
llvm::FunctionSummary::ParamAccess::Call
Describes the use of a value in a call instruction, specifying the call's target, the value's paramet...
Definition: ModuleSummaryIndex.h:628
llvm::GlobalValueSummaryInfo::GlobalValueSummaryInfo
GlobalValueSummaryInfo(bool HaveGVs)
Definition: ModuleSummaryIndex.h:149
llvm::GlobalVarSummary::GVarFlags::GVarFlags
GVarFlags(bool ReadOnly, bool WriteOnly, bool Constant, GlobalObject::VCallVisibility Vis)
Definition: ModuleSummaryIndex.h:892
llvm::TypeIdOffsetVtableInfo::AddressPointOffset
uint64_t AddressPointOffset
Definition: ModuleSummaryIndex.h:1067
llvm::GlobalValueSummary::~GlobalValueSummary
virtual ~GlobalValueSummary()=default
llvm::WholeProgramDevirtResolution
Definition: ModuleSummaryIndex.h:987
llvm::FunctionSummary::TypeIdInfo::TypeTests
std::vector< GlobalValue::GUID > TypeTests
List of type identifiers used by this function in llvm.type.test intrinsics referenced by something o...
Definition: ModuleSummaryIndex.h:548
llvm::FunctionSummary::setEntryCount
void setEntryCount(uint64_t EC)
Set the synthetic entry count for this function.
Definition: ModuleSummaryIndex.h:746
llvm::ModuleSummaryIndex::collectDefinedFunctionsForModule
void collectDefinedFunctionsForModule(StringRef ModulePath, GVSummaryMapTy &GVSummaryMap) const
Collect for the given module the list of functions it defines (GUID -> Summary).
Definition: ModuleSummaryIndex.cpp:147
llvm::GlobalValueSummary::GVFlags::Live
unsigned Live
In per-module summary, indicate that the global value must be considered a live root for index-based ...
Definition: ModuleSummaryIndex.h:318
llvm::GlobalValueSummary::GVFlags::DSOLocal
unsigned DSOLocal
Indicates that the linker resolved the symbol to a definition from within the same linkage unit.
Definition: ModuleSummaryIndex.h:322
llvm::FunctionSummary::FFlags::NoUnwind
unsigned NoUnwind
Definition: ModuleSummaryIndex.h:577
llvm::CalleeInfo::ScaleShift
static constexpr int32_t ScaleShift
Definition: ModuleSummaryIndex.h:73
llvm::ValueInfo::isValidAccessSpecifier
bool isValidAccessSpecifier() const
Definition: ModuleSummaryIndex.h:209
llvm::GraphTraits
Definition: GraphTraits.h:35
llvm::ModuleSummaryIndex::withAttributePropagation
bool withAttributePropagation() const
Definition: ModuleSummaryIndex.h:1266
llvm::ModuleSummaryIndex::addGlobalValueSummary
void addGlobalValueSummary(ValueInfo VI, std::unique_ptr< GlobalValueSummary > Summary)
Add a global value summary for the given ValueInfo.
Definition: ModuleSummaryIndex.h:1368
llvm::DenseMapInfo< ValueInfo >::getTombstoneKey
static ValueInfo getTombstoneKey()
Definition: ModuleSummaryIndex.h:271
llvm::ModuleSummaryIndex::discoverNodes
static void discoverNodes(ValueInfo V, std::map< ValueInfo, bool > &FunctionHasParent)
Convenience function for doing a DFS on a ValueInfo.
Definition: ModuleSummaryIndex.h:1198
llvm::FunctionSummary::TypeIdInfo::TypeTestAssumeVCalls
std::vector< VFuncId > TypeTestAssumeVCalls
List of virtual calls made by this function using (respectively) llvm.assume(llvm....
Definition: ModuleSummaryIndex.h:553
raw_ostream.h
llvm::FunctionSummary::FunctionSummary
FunctionSummary(GVFlags Flags, unsigned NumInsts, FFlags FunFlags, uint64_t EntryCount, std::vector< ValueInfo > Refs, std::vector< EdgeTy > CGEdges, std::vector< GlobalValue::GUID > TypeTests, std::vector< VFuncId > TypeTestAssumeVCalls, std::vector< VFuncId > TypeCheckedLoadVCalls, std::vector< ConstVCall > TypeTestAssumeConstVCalls, std::vector< ConstVCall > TypeCheckedLoadConstVCalls, std::vector< ParamAccess > Params)
Definition: ModuleSummaryIndex.h:701
llvm::TypeTestResolution::ByteArray
@ ByteArray
Test a byte array (first example)
Definition: ModuleSummaryIndex.h:963
llvm::TypeIdSummaryMapTy
std::multimap< GlobalValue::GUID, std::pair< std::string, TypeIdSummary > > TypeIdSummaryMapTy
Map of a type GUID to type id string and summary (multimap used in case of GUID conflicts).
Definition: ModuleSummaryIndex.h:1051
llvm::DenseMapInfo< FunctionSummary::ConstVCall >::getHashValue
static unsigned getHashValue(FunctionSummary::ConstVCall I)
Definition: ModuleSummaryIndex.h:858
llvm::FunctionSummary::ConstVCall::VFunc
VFuncId VFunc
Definition: ModuleSummaryIndex.h:538
llvm::GlobalValueSummary::setOriginalName
void setOriginalName(GlobalValue::GUID Name)
Initialize the original name hash in this summary.
Definition: ModuleSummaryIndex.h:386
llvm::ModuleHash
std::array< uint32_t, 5 > ModuleHash
160 bits SHA1
Definition: ModuleSummaryIndex.h:1033
llvm::raw_string_ostream::str
std::string & str()
Flushes the stream contents to the target string and returns the string's reference.
Definition: raw_ostream.h:643
llvm::FunctionSummary::VFuncId::GUID
GlobalValue::GUID GUID
Definition: ModuleSummaryIndex.h:530
llvm::GlobalVarSummary::VarFlags
struct llvm::GlobalVarSummary::GVarFlags VarFlags
llvm::GraphTraits< ValueInfo >::EdgeRef
FunctionSummary::EdgeTy & EdgeRef
Definition: ModuleSummaryIndex.h:1587
llvm::WholeProgramDevirtResolution::ByArg::Bit
uint32_t Bit
Definition: ModuleSummaryIndex.h:1016
llvm::FunctionSummary::TypeIdInfo::TypeCheckedLoadConstVCalls
std::vector< ConstVCall > TypeCheckedLoadConstVCalls
Definition: ModuleSummaryIndex.h:559
llvm::ModuleSummaryIndex::addModule
ModuleInfo * addModule(StringRef ModPath, uint64_t ModId, ModuleHash Hash=ModuleHash{{0}})
Add a new module with the given Hash, mapped to the given ModID, and return a reference to the module...
Definition: ModuleSummaryIndex.h:1473
llvm::FunctionSummary::getTypeIdInfo
const TypeIdInfo * getTypeIdInfo() const
Definition: ModuleSummaryIndex.h:824
llvm::DenseMapInfo< ValueInfo >::isSpecialKey
static bool isSpecialKey(ValueInfo V)
Definition: ModuleSummaryIndex.h:275
llvm::AliasSummary::getAliaseeGUID
GlobalValue::GUID getAliaseeGUID() const
Definition: ModuleSummaryIndex.h:493
llvm::GlobalVarSummary::GVarFlags::MaybeReadOnly
unsigned MaybeReadOnly
Definition: ModuleSummaryIndex.h:902
llvm::ValueInfo::isReadOnly
bool isReadOnly() const
Definition: ModuleSummaryIndex.h:197
llvm::TypeTestResolution::SizeM1BitWidth
unsigned SizeM1BitWidth
Range of size-1 expressed as a bit width.
Definition: ModuleSummaryIndex.h:974
llvm::Use
A Use represents the edge between a Value definition and its users.
Definition: Use.h:44
llvm::DenseMapInfo< FunctionSummary::ConstVCall >::isEqual
static bool isEqual(FunctionSummary::ConstVCall L, FunctionSummary::ConstVCall R)
Definition: ModuleSummaryIndex.h:852
llvm::GraphTraits< ValueInfo >
GraphTraits definition to build SCC for the index.
Definition: ModuleSummaryIndex.h:1585
llvm::AliasSummary::getAliaseeVI
ValueInfo getAliaseeVI() const
Definition: ModuleSummaryIndex.h:489
llvm::GlobalValueSummary::setDSOLocal
void setDSOLocal(bool Local)
Definition: ModuleSummaryIndex.h:419
llvm::ModuleSummaryIndex::getOrInsertTypeIdCompatibleVtableSummary
TypeIdCompatibleVtableInfo & getOrInsertTypeIdCompatibleVtableSummary(StringRef TypeId)
Return an existing or new TypeIdCompatibleVtableMap entry for TypeId.
Definition: ModuleSummaryIndex.h:1531
llvm::ModuleSummaryIndex::getRegularLTOModuleName
static constexpr const char * getRegularLTOModuleName()
Definition: ModuleSummaryIndex.h:1177