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  // Indicate if a function must be an unreachable function.
585  //
586  // This bit is sufficient but not necessary;
587  // if this bit is on, the function must be regarded as unreachable;
588  // if this bit is off, the function might be reachable or unreachable.
589  unsigned MustBeUnreachable : 1;
590 
592  this->ReadNone &= RHS.ReadNone;
593  this->ReadOnly &= RHS.ReadOnly;
594  this->NoRecurse &= RHS.NoRecurse;
596  this->NoInline &= RHS.NoInline;
597  this->AlwaysInline &= RHS.AlwaysInline;
598  this->NoUnwind &= RHS.NoUnwind;
599  this->MayThrow &= RHS.MayThrow;
600  this->HasUnknownCall &= RHS.HasUnknownCall;
602  return *this;
603  }
604 
605  bool anyFlagSet() {
606  return this->ReadNone | this->ReadOnly | this->NoRecurse |
607  this->ReturnDoesNotAlias | this->NoInline | this->AlwaysInline |
608  this->NoUnwind | this->MayThrow | this->HasUnknownCall |
609  this->MustBeUnreachable;
610  }
611 
612  operator std::string() {
613  std::string Output;
614  raw_string_ostream OS(Output);
615  OS << "funcFlags: (";
616  OS << "readNone: " << this->ReadNone;
617  OS << ", readOnly: " << this->ReadOnly;
618  OS << ", noRecurse: " << this->NoRecurse;
619  OS << ", returnDoesNotAlias: " << this->ReturnDoesNotAlias;
620  OS << ", noInline: " << this->NoInline;
621  OS << ", alwaysInline: " << this->AlwaysInline;
622  OS << ", noUnwind: " << this->NoUnwind;
623  OS << ", mayThrow: " << this->MayThrow;
624  OS << ", hasUnknownCall: " << this->HasUnknownCall;
625  OS << ", mustBeUnreachable: " << this->MustBeUnreachable;
626  OS << ")";
627  return OS.str();
628  }
629  };
630 
631  /// Describes the uses of a parameter by the function.
632  struct ParamAccess {
633  static constexpr uint32_t RangeWidth = 64;
634 
635  /// Describes the use of a value in a call instruction, specifying the
636  /// call's target, the value's parameter number, and the possible range of
637  /// offsets from the beginning of the value that are passed.
638  struct Call {
641  ConstantRange Offsets{/*BitWidth=*/RangeWidth, /*isFullSet=*/true};
642 
643  Call() = default;
646  };
647 
649  /// The range contains byte offsets from the parameter pointer which
650  /// accessed by the function. In the per-module summary, it only includes
651  /// accesses made by the function instructions. In the combined summary, it
652  /// also includes accesses by nested function calls.
653  ConstantRange Use{/*BitWidth=*/RangeWidth, /*isFullSet=*/true};
654  /// In the per-module summary, it summarizes the byte offset applied to each
655  /// pointer parameter before passing to each corresponding callee.
656  /// In the combined summary, it's empty and information is propagated by
657  /// inter-procedural analysis and applied to the Use field.
658  std::vector<Call> Calls;
659 
660  ParamAccess() = default;
662  : ParamNo(ParamNo), Use(Use) {}
663  };
664 
665  /// Create an empty FunctionSummary (with specified call edges).
666  /// Used to represent external nodes and the dummy root node.
667  static FunctionSummary
668  makeDummyFunctionSummary(std::vector<FunctionSummary::EdgeTy> Edges) {
669  return FunctionSummary(
671  GlobalValue::LinkageTypes::AvailableExternallyLinkage,
673  /*NotEligibleToImport=*/true, /*Live=*/true, /*IsLocal=*/false,
674  /*CanAutoHide=*/false),
675  /*NumInsts=*/0, FunctionSummary::FFlags{}, /*EntryCount=*/0,
676  std::vector<ValueInfo>(), std::move(Edges),
677  std::vector<GlobalValue::GUID>(),
678  std::vector<FunctionSummary::VFuncId>(),
679  std::vector<FunctionSummary::VFuncId>(),
680  std::vector<FunctionSummary::ConstVCall>(),
681  std::vector<FunctionSummary::ConstVCall>(),
682  std::vector<FunctionSummary::ParamAccess>());
683  }
684 
685  /// A dummy node to reference external functions that aren't in the index
687 
688 private:
689  /// Number of instructions (ignoring debug instructions, e.g.) computed
690  /// during the initial compile step when the summary index is first built.
691  unsigned InstCount;
692 
693  /// Function summary specific flags.
694  FFlags FunFlags;
695 
696  /// The synthesized entry count of the function.
697  /// This is only populated during ThinLink phase and remains unused while
698  /// generating per-module summaries.
699  uint64_t EntryCount = 0;
700 
701  /// List of <CalleeValueInfo, CalleeInfo> call edge pairs from this function.
702  std::vector<EdgeTy> CallGraphEdgeList;
703 
704  std::unique_ptr<TypeIdInfo> TIdInfo;
705 
706  /// Uses for every parameter to this function.
707  using ParamAccessesTy = std::vector<ParamAccess>;
708  std::unique_ptr<ParamAccessesTy> ParamAccesses;
709 
710 public:
711  FunctionSummary(GVFlags Flags, unsigned NumInsts, FFlags FunFlags,
712  uint64_t EntryCount, std::vector<ValueInfo> Refs,
713  std::vector<EdgeTy> CGEdges,
714  std::vector<GlobalValue::GUID> TypeTests,
715  std::vector<VFuncId> TypeTestAssumeVCalls,
716  std::vector<VFuncId> TypeCheckedLoadVCalls,
717  std::vector<ConstVCall> TypeTestAssumeConstVCalls,
718  std::vector<ConstVCall> TypeCheckedLoadConstVCalls,
719  std::vector<ParamAccess> Params)
720  : GlobalValueSummary(FunctionKind, Flags, std::move(Refs)),
721  InstCount(NumInsts), FunFlags(FunFlags), EntryCount(EntryCount),
722  CallGraphEdgeList(std::move(CGEdges)) {
723  if (!TypeTests.empty() || !TypeTestAssumeVCalls.empty() ||
724  !TypeCheckedLoadVCalls.empty() || !TypeTestAssumeConstVCalls.empty() ||
725  !TypeCheckedLoadConstVCalls.empty())
726  TIdInfo = std::make_unique<TypeIdInfo>(
727  TypeIdInfo{std::move(TypeTests), std::move(TypeTestAssumeVCalls),
728  std::move(TypeCheckedLoadVCalls),
729  std::move(TypeTestAssumeConstVCalls),
730  std::move(TypeCheckedLoadConstVCalls)});
731  if (!Params.empty())
732  ParamAccesses = std::make_unique<ParamAccessesTy>(std::move(Params));
733  }
734  // Gets the number of readonly and writeonly refs in RefEdgeList
735  std::pair<unsigned, unsigned> specialRefCounts() const;
736 
737  /// Check if this is a function summary.
738  static bool classof(const GlobalValueSummary *GVS) {
739  return GVS->getSummaryKind() == FunctionKind;
740  }
741 
742  /// Get function summary flags.
743  FFlags fflags() const { return FunFlags; }
744 
745  void setNoRecurse() { FunFlags.NoRecurse = true; }
746 
747  void setNoUnwind() { FunFlags.NoUnwind = true; }
748 
749  /// Get the instruction count recorded for this function.
750  unsigned instCount() const { return InstCount; }
751 
752  /// Get the synthetic entry count for this function.
753  uint64_t entryCount() const { return EntryCount; }
754 
755  /// Set the synthetic entry count for this function.
756  void setEntryCount(uint64_t EC) { EntryCount = EC; }
757 
758  /// Return the list of <CalleeValueInfo, CalleeInfo> pairs.
759  ArrayRef<EdgeTy> calls() const { return CallGraphEdgeList; }
760 
761  std::vector<EdgeTy> &mutableCalls() { return CallGraphEdgeList; }
762 
763  void addCall(EdgeTy E) { CallGraphEdgeList.push_back(E); }
764 
765  /// Returns the list of type identifiers used by this function in
766  /// llvm.type.test intrinsics other than by an llvm.assume intrinsic,
767  /// represented as GUIDs.
769  if (TIdInfo)
770  return TIdInfo->TypeTests;
771  return {};
772  }
773 
774  /// Returns the list of virtual calls made by this function using
775  /// llvm.assume(llvm.type.test) intrinsics that do not have all constant
776  /// integer arguments.
778  if (TIdInfo)
779  return TIdInfo->TypeTestAssumeVCalls;
780  return {};
781  }
782 
783  /// Returns the list of virtual calls made by this function using
784  /// llvm.type.checked.load intrinsics that do not have all constant integer
785  /// arguments.
787  if (TIdInfo)
788  return TIdInfo->TypeCheckedLoadVCalls;
789  return {};
790  }
791 
792  /// Returns the list of virtual calls made by this function using
793  /// llvm.assume(llvm.type.test) intrinsics with all constant integer
794  /// arguments.
796  if (TIdInfo)
797  return TIdInfo->TypeTestAssumeConstVCalls;
798  return {};
799  }
800 
801  /// Returns the list of virtual calls made by this function using
802  /// llvm.type.checked.load intrinsics with all constant integer arguments.
804  if (TIdInfo)
805  return TIdInfo->TypeCheckedLoadConstVCalls;
806  return {};
807  }
808 
809  /// Returns the list of known uses of pointer parameters.
811  if (ParamAccesses)
812  return *ParamAccesses;
813  return {};
814  }
815 
816  /// Sets the list of known uses of pointer parameters.
817  void setParamAccesses(std::vector<ParamAccess> NewParams) {
818  if (NewParams.empty())
819  ParamAccesses.reset();
820  else if (ParamAccesses)
821  *ParamAccesses = std::move(NewParams);
822  else
823  ParamAccesses = std::make_unique<ParamAccessesTy>(std::move(NewParams));
824  }
825 
826  /// Add a type test to the summary. This is used by WholeProgramDevirt if we
827  /// were unable to devirtualize a checked call.
829  if (!TIdInfo)
830  TIdInfo = std::make_unique<TypeIdInfo>();
831  TIdInfo->TypeTests.push_back(Guid);
832  }
833 
834  const TypeIdInfo *getTypeIdInfo() const { return TIdInfo.get(); };
835 
836  friend struct GraphTraits<ValueInfo>;
837 };
838 
839 template <> struct DenseMapInfo<FunctionSummary::VFuncId> {
840  static FunctionSummary::VFuncId getEmptyKey() { return {0, uint64_t(-1)}; }
841 
843  return {0, uint64_t(-2)};
844  }
845 
847  return L.GUID == R.GUID && L.Offset == R.Offset;
848  }
849 
850  static unsigned getHashValue(FunctionSummary::VFuncId I) { return I.GUID; }
851 };
852 
853 template <> struct DenseMapInfo<FunctionSummary::ConstVCall> {
855  return {{0, uint64_t(-1)}, {}};
856  }
857 
859  return {{0, uint64_t(-2)}, {}};
860  }
861 
865  L.Args == R.Args;
866  }
867 
869  return I.VFunc.GUID;
870  }
871 };
872 
873 /// The ValueInfo and offset for a function within a vtable definition
874 /// initializer array.
877  : FuncVI(VI), VTableOffset(Offset) {}
878 
881 };
882 /// List of functions referenced by a particular vtable definition.
883 using VTableFuncList = std::vector<VirtFuncOffset>;
884 
885 /// Global variable summary information to aid decisions and
886 /// implementation of importing.
887 ///
888 /// Global variable summary has two extra flag, telling if it is
889 /// readonly or writeonly. Both readonly and writeonly variables
890 /// can be optimized in the backed: readonly variables can be
891 /// const-folded, while writeonly vars can be completely eliminated
892 /// together with corresponding stores. We let both things happen
893 /// by means of internalizing such variables after ThinLTO import.
895 private:
896  /// For vtable definitions this holds the list of functions and
897  /// their corresponding offsets within the initializer array.
898  std::unique_ptr<VTableFuncList> VTableFuncs;
899 
900 public:
901  struct GVarFlags {
902  GVarFlags(bool ReadOnly, bool WriteOnly, bool Constant,
904  : MaybeReadOnly(ReadOnly), MaybeWriteOnly(WriteOnly),
906 
907  // If true indicates that this global variable might be accessed
908  // purely by non-volatile load instructions. This in turn means
909  // it can be internalized in source and destination modules during
910  // thin LTO import because it neither modified nor its address
911  // is taken.
912  unsigned MaybeReadOnly : 1;
913  // If true indicates that variable is possibly only written to, so
914  // its value isn't loaded and its address isn't taken anywhere.
915  // False, when 'Constant' attribute is set.
916  unsigned MaybeWriteOnly : 1;
917  // Indicates that value is a compile-time constant. Global variable
918  // can be 'Constant' while not being 'ReadOnly' on several occasions:
919  // - it is volatile, (e.g mapped device address)
920  // - its address is taken, meaning that unlike 'ReadOnly' vars we can't
921  // internalize it.
922  // Constant variables are always imported thus giving compiler an
923  // opportunity to make some extra optimizations. Readonly constants
924  // are also internalized.
925  unsigned Constant : 1;
926  // Set from metadata on vtable definitions during the module summary
927  // analysis.
928  unsigned VCallVisibility : 2;
929  } VarFlags;
930 
932  std::vector<ValueInfo> Refs)
933  : GlobalValueSummary(GlobalVarKind, Flags, std::move(Refs)),
934  VarFlags(VarFlags) {}
935 
936  /// Check if this is a global variable summary.
937  static bool classof(const GlobalValueSummary *GVS) {
938  return GVS->getSummaryKind() == GlobalVarKind;
939  }
940 
941  GVarFlags varflags() const { return VarFlags; }
942  void setReadOnly(bool RO) { VarFlags.MaybeReadOnly = RO; }
943  void setWriteOnly(bool WO) { VarFlags.MaybeWriteOnly = WO; }
944  bool maybeReadOnly() const { return VarFlags.MaybeReadOnly; }
945  bool maybeWriteOnly() const { return VarFlags.MaybeWriteOnly; }
946  bool isConstant() const { return VarFlags.Constant; }
949  }
952  }
953 
955  assert(!VTableFuncs);
956  VTableFuncs = std::make_unique<VTableFuncList>(std::move(Funcs));
957  }
958 
960  if (VTableFuncs)
961  return *VTableFuncs;
962  return {};
963  }
964 };
965 
967  /// Specifies which kind of type check we should emit for this byte array.
968  /// See http://clang.llvm.org/docs/ControlFlowIntegrityDesign.html for full
969  /// details on each kind of check; the enumerators are described with
970  /// reference to that document.
971  enum Kind {
972  Unsat, ///< Unsatisfiable type (i.e. no global has this type metadata)
973  ByteArray, ///< Test a byte array (first example)
974  Inline, ///< Inlined bit vector ("Short Inline Bit Vectors")
975  Single, ///< Single element (last example in "Short Inline Bit Vectors")
976  AllOnes, ///< All-ones bit vector ("Eliminating Bit Vector Checks for
977  /// All-Ones Bit Vectors")
978  Unknown, ///< Unknown (analysis not performed, don't lower)
979  } TheKind = Unknown;
980 
981  /// Range of size-1 expressed as a bit width. For example, if the size is in
982  /// range [1,256], this number will be 8. This helps generate the most compact
983  /// instruction sequences.
984  unsigned SizeM1BitWidth = 0;
985 
986  // The following fields are only used if the target does not support the use
987  // of absolute symbols to store constants. Their meanings are the same as the
988  // corresponding fields in LowerTypeTestsModule::TypeIdLowering in
989  // LowerTypeTests.cpp.
990 
993  uint8_t BitMask = 0;
995 };
996 
998  enum Kind {
999  Indir, ///< Just do a regular virtual call
1000  SingleImpl, ///< Single implementation devirtualization
1001  BranchFunnel, ///< When retpoline mitigation is enabled, use a branch funnel
1002  ///< that is defined in the merged module. Otherwise same as
1003  ///< Indir.
1004  } TheKind = Indir;
1005 
1006  std::string SingleImplName;
1007 
1008  struct ByArg {
1009  enum Kind {
1010  Indir, ///< Just do a regular virtual call
1011  UniformRetVal, ///< Uniform return value optimization
1012  UniqueRetVal, ///< Unique return value optimization
1013  VirtualConstProp, ///< Virtual constant propagation
1014  } TheKind = Indir;
1015 
1016  /// Additional information for the resolution:
1017  /// - UniformRetVal: the uniform return value.
1018  /// - UniqueRetVal: the return value associated with the unique vtable (0 or
1019  /// 1).
1021 
1022  // The following fields are only used if the target does not support the use
1023  // of absolute symbols to store constants.
1024 
1027  };
1028 
1029  /// Resolutions for calls with all constant integer arguments (excluding the
1030  /// first argument, "this"), where the key is the argument vector.
1031  std::map<std::vector<uint64_t>, ByArg> ResByArg;
1032 };
1033 
1036 
1037  /// Mapping from byte offset to whole-program devirt resolution for that
1038  /// (typeid, byte offset) pair.
1039  std::map<uint64_t, WholeProgramDevirtResolution> WPDRes;
1040 };
1041 
1042 /// 160 bits SHA1
1043 using ModuleHash = std::array<uint32_t, 5>;
1044 
1045 /// Type used for iterating through the global value summary map.
1046 using const_gvsummary_iterator = GlobalValueSummaryMapTy::const_iterator;
1047 using gvsummary_iterator = GlobalValueSummaryMapTy::iterator;
1048 
1049 /// String table to hold/own module path strings, which additionally holds the
1050 /// module ID assigned to each module during the plugin step, as well as a hash
1051 /// of the module. The StringMap makes a copy of and owns inserted strings.
1053 
1054 /// Map of global value GUID to its summary, used to identify values defined in
1055 /// a particular module, and provide efficient access to their summary.
1057 
1058 /// Map of a type GUID to type id string and summary (multimap used
1059 /// in case of GUID conflicts).
1060 using TypeIdSummaryMapTy =
1061  std::multimap<GlobalValue::GUID, std::pair<std::string, TypeIdSummary>>;
1062 
1063 /// The following data structures summarize type metadata information.
1064 /// For type metadata overview see https://llvm.org/docs/TypeMetadata.html.
1065 /// Each type metadata includes both the type identifier and the offset of
1066 /// the address point of the type (the address held by objects of that type
1067 /// which may not be the beginning of the virtual table). Vtable definitions
1068 /// are decorated with type metadata for the types they are compatible with.
1069 ///
1070 /// Holds information about vtable definitions decorated with type metadata:
1071 /// the vtable definition value and its address point offset in a type
1072 /// identifier metadata it is decorated (compatible) with.
1076 
1079 };
1080 /// List of vtable definitions decorated by a particular type identifier,
1081 /// and their corresponding offsets in that type identifier's metadata.
1082 /// Note that each type identifier may be compatible with multiple vtables, due
1083 /// to inheritance, which is why this is a vector.
1084 using TypeIdCompatibleVtableInfo = std::vector<TypeIdOffsetVtableInfo>;
1085 
1086 /// Class to hold module path string table and global value map,
1087 /// and encapsulate methods for operating on them.
1089 private:
1090  /// Map from value name to list of summary instances for values of that
1091  /// name (may be duplicates in the COMDAT case, e.g.).
1092  GlobalValueSummaryMapTy GlobalValueMap;
1093 
1094  /// Holds strings for combined index, mapping to the corresponding module ID.
1095  ModulePathStringTableTy ModulePathStringTable;
1096 
1097  /// Mapping from type identifier GUIDs to type identifier and its summary
1098  /// information. Produced by thin link.
1099  TypeIdSummaryMapTy TypeIdMap;
1100 
1101  /// Mapping from type identifier to information about vtables decorated
1102  /// with that type identifier's metadata. Produced by per module summary
1103  /// analysis and consumed by thin link. For more information, see description
1104  /// above where TypeIdCompatibleVtableInfo is defined.
1105  std::map<std::string, TypeIdCompatibleVtableInfo, std::less<>>
1106  TypeIdCompatibleVtableMap;
1107 
1108  /// Mapping from original ID to GUID. If original ID can map to multiple
1109  /// GUIDs, it will be mapped to 0.
1110  std::map<GlobalValue::GUID, GlobalValue::GUID> OidGuidMap;
1111 
1112  /// Indicates that summary-based GlobalValue GC has run, and values with
1113  /// GVFlags::Live==false are really dead. Otherwise, all values must be
1114  /// considered live.
1115  bool WithGlobalValueDeadStripping = false;
1116 
1117  /// Indicates that summary-based attribute propagation has run and
1118  /// GVarFlags::MaybeReadonly / GVarFlags::MaybeWriteonly are really
1119  /// read/write only.
1120  bool WithAttributePropagation = false;
1121 
1122  /// Indicates that summary-based DSOLocal propagation has run and the flag in
1123  /// every summary of a GV is synchronized.
1124  bool WithDSOLocalPropagation = false;
1125 
1126  /// Indicates that summary-based synthetic entry count propagation has run
1127  bool HasSyntheticEntryCounts = false;
1128 
1129  /// Indicates that distributed backend should skip compilation of the
1130  /// module. Flag is suppose to be set by distributed ThinLTO indexing
1131  /// when it detected that the module is not needed during the final
1132  /// linking. As result distributed backend should just output a minimal
1133  /// valid object file.
1134  bool SkipModuleByDistributedBackend = false;
1135 
1136  /// If true then we're performing analysis of IR module, or parsing along with
1137  /// the IR from assembly. The value of 'false' means we're reading summary
1138  /// from BC or YAML source. Affects the type of value stored in NameOrGV
1139  /// union.
1140  bool HaveGVs;
1141 
1142  // True if the index was created for a module compiled with -fsplit-lto-unit.
1143  bool EnableSplitLTOUnit;
1144 
1145  // True if some of the modules were compiled with -fsplit-lto-unit and
1146  // some were not. Set when the combined index is created during the thin link.
1147  bool PartiallySplitLTOUnits = false;
1148 
1149  /// True if some of the FunctionSummary contains a ParamAccess.
1150  bool HasParamAccess = false;
1151 
1152  std::set<std::string> CfiFunctionDefs;
1153  std::set<std::string> CfiFunctionDecls;
1154 
1155  // Used in cases where we want to record the name of a global, but
1156  // don't have the string owned elsewhere (e.g. the Strtab on a module).
1157  StringSaver Saver;
1158  BumpPtrAllocator Alloc;
1159 
1160  // The total number of basic blocks in the module in the per-module summary or
1161  // the total number of basic blocks in the LTO unit in the combined index.
1162  uint64_t BlockCount;
1163 
1164  // YAML I/O support.
1166 
1167  GlobalValueSummaryMapTy::value_type *
1168  getOrInsertValuePtr(GlobalValue::GUID GUID) {
1169  return &*GlobalValueMap.emplace(GUID, GlobalValueSummaryInfo(HaveGVs))
1170  .first;
1171  }
1172 
1173 public:
1174  // See HaveGVs variable comment.
1175  ModuleSummaryIndex(bool HaveGVs, bool EnableSplitLTOUnit = false)
1176  : HaveGVs(HaveGVs), EnableSplitLTOUnit(EnableSplitLTOUnit), Saver(Alloc),
1177  BlockCount(0) {}
1178 
1179  // Current version for the module summary in bitcode files.
1180  // The BitcodeSummaryVersion should be bumped whenever we introduce changes
1181  // in the way some record are interpreted, like flags for instance.
1182  // Note that incrementing this may require changes in both BitcodeReader.cpp
1183  // and BitcodeWriter.cpp.
1184  static constexpr uint64_t BitcodeSummaryVersion = 9;
1185 
1186  // Regular LTO module name for ASM writer
1187  static constexpr const char *getRegularLTOModuleName() {
1188  return "[Regular LTO]";
1189  }
1190 
1191  bool haveGVs() const { return HaveGVs; }
1192 
1193  uint64_t getFlags() const;
1194  void setFlags(uint64_t Flags);
1195 
1196  uint64_t getBlockCount() const { return BlockCount; }
1197  void addBlockCount(uint64_t C) { BlockCount += C; }
1198  void setBlockCount(uint64_t C) { BlockCount = C; }
1199 
1200  gvsummary_iterator begin() { return GlobalValueMap.begin(); }
1201  const_gvsummary_iterator begin() const { return GlobalValueMap.begin(); }
1202  gvsummary_iterator end() { return GlobalValueMap.end(); }
1203  const_gvsummary_iterator end() const { return GlobalValueMap.end(); }
1204  size_t size() const { return GlobalValueMap.size(); }
1205 
1206  /// Convenience function for doing a DFS on a ValueInfo. Marks the function in
1207  /// the FunctionHasParent map.
1208  static void discoverNodes(ValueInfo V,
1209  std::map<ValueInfo, bool> &FunctionHasParent) {
1210  if (!V.getSummaryList().size())
1211  return; // skip external functions that don't have summaries
1212 
1213  // Mark discovered if we haven't yet
1214  auto S = FunctionHasParent.emplace(V, false);
1215 
1216  // Stop if we've already discovered this node
1217  if (!S.second)
1218  return;
1219 
1220  FunctionSummary *F =
1221  dyn_cast<FunctionSummary>(V.getSummaryList().front().get());
1222  assert(F != nullptr && "Expected FunctionSummary node");
1223 
1224  for (auto &C : F->calls()) {
1225  // Insert node if necessary
1226  auto S = FunctionHasParent.emplace(C.first, true);
1227 
1228  // Skip nodes that we're sure have parents
1229  if (!S.second && S.first->second)
1230  continue;
1231 
1232  if (S.second)
1233  discoverNodes(C.first, FunctionHasParent);
1234  else
1235  S.first->second = true;
1236  }
1237  }
1238 
1239  // Calculate the callgraph root
1241  // Functions that have a parent will be marked in FunctionHasParent pair.
1242  // Once we've marked all functions, the functions in the map that are false
1243  // have no parent (so they're the roots)
1244  std::map<ValueInfo, bool> FunctionHasParent;
1245 
1246  for (auto &S : *this) {
1247  // Skip external functions
1248  if (!S.second.SummaryList.size() ||
1249  !isa<FunctionSummary>(S.second.SummaryList.front().get()))
1250  continue;
1251  discoverNodes(ValueInfo(HaveGVs, &S), FunctionHasParent);
1252  }
1253 
1254  std::vector<FunctionSummary::EdgeTy> Edges;
1255  // create edges to all roots in the Index
1256  for (auto &P : FunctionHasParent) {
1257  if (P.second)
1258  continue; // skip over non-root nodes
1259  Edges.push_back(std::make_pair(P.first, CalleeInfo{}));
1260  }
1261  if (Edges.empty()) {
1262  // Failed to find root - return an empty node
1264  }
1265  auto CallGraphRoot = FunctionSummary::makeDummyFunctionSummary(Edges);
1266  return CallGraphRoot;
1267  }
1268 
1270  return WithGlobalValueDeadStripping;
1271  }
1273  WithGlobalValueDeadStripping = true;
1274  }
1275 
1276  bool withAttributePropagation() const { return WithAttributePropagation; }
1278  WithAttributePropagation = true;
1279  }
1280 
1281  bool withDSOLocalPropagation() const { return WithDSOLocalPropagation; }
1282  void setWithDSOLocalPropagation() { WithDSOLocalPropagation = true; }
1283 
1284  bool isReadOnly(const GlobalVarSummary *GVS) const {
1285  return WithAttributePropagation && GVS->maybeReadOnly();
1286  }
1287  bool isWriteOnly(const GlobalVarSummary *GVS) const {
1288  return WithAttributePropagation && GVS->maybeWriteOnly();
1289  }
1290 
1291  bool hasSyntheticEntryCounts() const { return HasSyntheticEntryCounts; }
1292  void setHasSyntheticEntryCounts() { HasSyntheticEntryCounts = true; }
1293 
1295  return SkipModuleByDistributedBackend;
1296  }
1298  SkipModuleByDistributedBackend = true;
1299  }
1300 
1301  bool enableSplitLTOUnit() const { return EnableSplitLTOUnit; }
1302  void setEnableSplitLTOUnit() { EnableSplitLTOUnit = true; }
1303 
1304  bool partiallySplitLTOUnits() const { return PartiallySplitLTOUnits; }
1305  void setPartiallySplitLTOUnits() { PartiallySplitLTOUnits = true; }
1306 
1307  bool hasParamAccess() const { return HasParamAccess; }
1308 
1309  bool isGlobalValueLive(const GlobalValueSummary *GVS) const {
1310  return !WithGlobalValueDeadStripping || GVS->isLive();
1311  }
1312  bool isGUIDLive(GlobalValue::GUID GUID) const;
1313 
1314  /// Return a ValueInfo for the index value_type (convenient when iterating
1315  /// index).
1316  ValueInfo getValueInfo(const GlobalValueSummaryMapTy::value_type &R) const {
1317  return ValueInfo(HaveGVs, &R);
1318  }
1319 
1320  /// Return a ValueInfo for GUID if it exists, otherwise return ValueInfo().
1322  auto I = GlobalValueMap.find(GUID);
1323  return ValueInfo(HaveGVs, I == GlobalValueMap.end() ? nullptr : &*I);
1324  }
1325 
1326  /// Return a ValueInfo for \p GUID.
1328  return ValueInfo(HaveGVs, getOrInsertValuePtr(GUID));
1329  }
1330 
1331  // Save a string in the Index. Use before passing Name to
1332  // getOrInsertValueInfo when the string isn't owned elsewhere (e.g. on the
1333  // module's Strtab).
1334  StringRef saveString(StringRef String) { return Saver.save(String); }
1335 
1336  /// Return a ValueInfo for \p GUID setting value \p Name.
1338  assert(!HaveGVs);
1339  auto VP = getOrInsertValuePtr(GUID);
1340  VP->second.U.Name = Name;
1341  return ValueInfo(HaveGVs, VP);
1342  }
1343 
1344  /// Return a ValueInfo for \p GV and mark it as belonging to GV.
1346  assert(HaveGVs);
1347  auto VP = getOrInsertValuePtr(GV->getGUID());
1348  VP->second.U.GV = GV;
1349  return ValueInfo(HaveGVs, VP);
1350  }
1351 
1352  /// Return the GUID for \p OriginalId in the OidGuidMap.
1354  const auto I = OidGuidMap.find(OriginalID);
1355  return I == OidGuidMap.end() ? 0 : I->second;
1356  }
1357 
1358  std::set<std::string> &cfiFunctionDefs() { return CfiFunctionDefs; }
1359  const std::set<std::string> &cfiFunctionDefs() const { return CfiFunctionDefs; }
1360 
1361  std::set<std::string> &cfiFunctionDecls() { return CfiFunctionDecls; }
1362  const std::set<std::string> &cfiFunctionDecls() const { return CfiFunctionDecls; }
1363 
1364  /// Add a global value summary for a value.
1366  std::unique_ptr<GlobalValueSummary> Summary) {
1368  }
1369 
1370  /// Add a global value summary for a value of the given name.
1372  std::unique_ptr<GlobalValueSummary> Summary) {
1374  std::move(Summary));
1375  }
1376 
1377  /// Add a global value summary for the given ValueInfo.
1379  std::unique_ptr<GlobalValueSummary> Summary) {
1380  if (const FunctionSummary *FS = dyn_cast<FunctionSummary>(Summary.get()))
1381  HasParamAccess |= !FS->paramAccesses().empty();
1382  addOriginalName(VI.getGUID(), Summary->getOriginalName());
1383  // Here we have a notionally const VI, but the value it points to is owned
1384  // by the non-const *this.
1385  const_cast<GlobalValueSummaryMapTy::value_type *>(VI.getRef())
1386  ->second.SummaryList.push_back(std::move(Summary));
1387  }
1388 
1389  /// Add an original name for the value of the given GUID.
1391  GlobalValue::GUID OrigGUID) {
1392  if (OrigGUID == 0 || ValueGUID == OrigGUID)
1393  return;
1394  if (OidGuidMap.count(OrigGUID) && OidGuidMap[OrigGUID] != ValueGUID)
1395  OidGuidMap[OrigGUID] = 0;
1396  else
1397  OidGuidMap[OrigGUID] = ValueGUID;
1398  }
1399 
1400  /// Find the summary for ValueInfo \p VI in module \p ModuleId, or nullptr if
1401  /// not found.
1403  auto SummaryList = VI.getSummaryList();
1404  auto Summary =
1405  llvm::find_if(SummaryList,
1406  [&](const std::unique_ptr<GlobalValueSummary> &Summary) {
1407  return Summary->modulePath() == ModuleId;
1408  });
1409  if (Summary == SummaryList.end())
1410  return nullptr;
1411  return Summary->get();
1412  }
1413 
1414  /// Find the summary for global \p GUID in module \p ModuleId, or nullptr if
1415  /// not found.
1417  StringRef ModuleId) const {
1418  auto CalleeInfo = getValueInfo(ValueGUID);
1419  if (!CalleeInfo)
1420  return nullptr; // This function does not have a summary
1421  return findSummaryInModule(CalleeInfo, ModuleId);
1422  }
1423 
1424  /// Returns the first GlobalValueSummary for \p GV, asserting that there
1425  /// is only one if \p PerModuleIndex.
1427  bool PerModuleIndex = true) const {
1428  assert(GV.hasName() && "Can't get GlobalValueSummary for GV with no name");
1429  return getGlobalValueSummary(GV.getGUID(), PerModuleIndex);
1430  }
1431 
1432  /// Returns the first GlobalValueSummary for \p ValueGUID, asserting that
1433  /// there
1434  /// is only one if \p PerModuleIndex.
1436  bool PerModuleIndex = true) const;
1437 
1438  /// Table of modules, containing module hash and id.
1440  return ModulePathStringTable;
1441  }
1442 
1443  /// Table of modules, containing hash and id.
1445  return ModulePathStringTable;
1446  }
1447 
1448  /// Get the module ID recorded for the given module path.
1449  uint64_t getModuleId(const StringRef ModPath) const {
1450  return ModulePathStringTable.lookup(ModPath).first;
1451  }
1452 
1453  /// Get the module SHA1 hash recorded for the given module path.
1454  const ModuleHash &getModuleHash(const StringRef ModPath) const {
1455  auto It = ModulePathStringTable.find(ModPath);
1456  assert(It != ModulePathStringTable.end() && "Module not registered");
1457  return It->second.second;
1458  }
1459 
1460  /// Convenience method for creating a promoted global name
1461  /// for the given value name of a local, and its original module's ID.
1462  static std::string getGlobalNameForLocal(StringRef Name, ModuleHash ModHash) {
1463  SmallString<256> NewName(Name);
1464  NewName += ".llvm.";
1465  NewName += utostr((uint64_t(ModHash[0]) << 32) |
1466  ModHash[1]); // Take the first 64 bits
1467  return std::string(NewName.str());
1468  }
1469 
1470  /// Helper to obtain the unpromoted name for a global value (or the original
1471  /// name if not promoted). Split off the rightmost ".llvm.${hash}" suffix,
1472  /// because it is possible in certain clients (not clang at the moment) for
1473  /// two rounds of ThinLTO optimization and therefore promotion to occur.
1475  std::pair<StringRef, StringRef> Pair = Name.rsplit(".llvm.");
1476  return Pair.first;
1477  }
1478 
1480 
1481  /// Add a new module with the given \p Hash, mapped to the given \p
1482  /// ModID, and return a reference to the module.
1484  ModuleHash Hash = ModuleHash{{0}}) {
1485  return &*ModulePathStringTable.insert({ModPath, {ModId, Hash}}).first;
1486  }
1487 
1488  /// Return module entry for module with the given \p ModPath.
1490  auto It = ModulePathStringTable.find(ModPath);
1491  assert(It != ModulePathStringTable.end() && "Module not registered");
1492  return &*It;
1493  }
1494 
1495  /// Check if the given Module has any functions available for exporting
1496  /// in the index. We consider any module present in the ModulePathStringTable
1497  /// to have exported functions.
1498  bool hasExportedFunctions(const Module &M) const {
1499  return ModulePathStringTable.count(M.getModuleIdentifier());
1500  }
1501 
1502  const TypeIdSummaryMapTy &typeIds() const { return TypeIdMap; }
1503 
1504  /// Return an existing or new TypeIdSummary entry for \p TypeId.
1505  /// This accessor can mutate the map and therefore should not be used in
1506  /// the ThinLTO backends.
1508  auto TidIter = TypeIdMap.equal_range(GlobalValue::getGUID(TypeId));
1509  for (auto It = TidIter.first; It != TidIter.second; ++It)
1510  if (It->second.first == TypeId)
1511  return It->second.second;
1512  auto It = TypeIdMap.insert(
1513  {GlobalValue::getGUID(TypeId), {std::string(TypeId), TypeIdSummary()}});
1514  return It->second.second;
1515  }
1516 
1517  /// This returns either a pointer to the type id summary (if present in the
1518  /// summary map) or null (if not present). This may be used when importing.
1520  auto TidIter = TypeIdMap.equal_range(GlobalValue::getGUID(TypeId));
1521  for (auto It = TidIter.first; It != TidIter.second; ++It)
1522  if (It->second.first == TypeId)
1523  return &It->second.second;
1524  return nullptr;
1525  }
1526 
1528  return const_cast<TypeIdSummary *>(
1529  static_cast<const ModuleSummaryIndex *>(this)->getTypeIdSummary(
1530  TypeId));
1531  }
1532 
1533  const auto &typeIdCompatibleVtableMap() const {
1534  return TypeIdCompatibleVtableMap;
1535  }
1536 
1537  /// Return an existing or new TypeIdCompatibleVtableMap entry for \p TypeId.
1538  /// This accessor can mutate the map and therefore should not be used in
1539  /// the ThinLTO backends.
1542  return TypeIdCompatibleVtableMap[std::string(TypeId)];
1543  }
1544 
1545  /// For the given \p TypeId, this returns the TypeIdCompatibleVtableMap
1546  /// entry if present in the summary map. This may be used when importing.
1549  auto I = TypeIdCompatibleVtableMap.find(TypeId);
1550  if (I == TypeIdCompatibleVtableMap.end())
1551  return None;
1552  return I->second;
1553  }
1554 
1555  /// Collect for the given module the list of functions it defines
1556  /// (GUID -> Summary).
1558  GVSummaryMapTy &GVSummaryMap) const;
1559 
1560  /// Collect for each module the list of Summaries it defines (GUID ->
1561  /// Summary).
1562  template <class Map>
1563  void
1564  collectDefinedGVSummariesPerModule(Map &ModuleToDefinedGVSummaries) const {
1565  for (auto &GlobalList : *this) {
1566  auto GUID = GlobalList.first;
1567  for (auto &Summary : GlobalList.second.SummaryList) {
1568  ModuleToDefinedGVSummaries[Summary->modulePath()][GUID] = Summary.get();
1569  }
1570  }
1571  }
1572 
1573  /// Print to an output stream.
1574  void print(raw_ostream &OS, bool IsForDebug = false) const;
1575 
1576  /// Dump to stderr (for debugging).
1577  void dump() const;
1578 
1579  /// Export summary to dot file for GraphViz.
1580  void
1582  const DenseSet<GlobalValue::GUID> &GUIDPreservedSymbols) const;
1583 
1584  /// Print out strongly connected components for debugging.
1585  void dumpSCCs(raw_ostream &OS);
1586 
1587  /// Do the access attribute and DSOLocal propagation in combined index.
1589 
1590  /// Checks if we can import global variable from another module.
1591  bool canImportGlobalVar(GlobalValueSummary *S, bool AnalyzeRefs) const;
1592 };
1593 
1594 /// GraphTraits definition to build SCC for the index
1595 template <> struct GraphTraits<ValueInfo> {
1598 
1600  return P.first;
1601  }
1602  using ChildIteratorType =
1604  decltype(&valueInfoFromEdge)>;
1605 
1606  using ChildEdgeIteratorType = std::vector<FunctionSummary::EdgeTy>::iterator;
1607 
1608  static NodeRef getEntryNode(ValueInfo V) { return V; }
1609 
1611  if (!N.getSummaryList().size()) // handle external function
1612  return ChildIteratorType(
1613  FunctionSummary::ExternalNode.CallGraphEdgeList.begin(),
1614  &valueInfoFromEdge);
1615  FunctionSummary *F =
1616  cast<FunctionSummary>(N.getSummaryList().front()->getBaseObject());
1617  return ChildIteratorType(F->CallGraphEdgeList.begin(), &valueInfoFromEdge);
1618  }
1619 
1621  if (!N.getSummaryList().size()) // handle external function
1622  return ChildIteratorType(
1623  FunctionSummary::ExternalNode.CallGraphEdgeList.end(),
1624  &valueInfoFromEdge);
1625  FunctionSummary *F =
1626  cast<FunctionSummary>(N.getSummaryList().front()->getBaseObject());
1627  return ChildIteratorType(F->CallGraphEdgeList.end(), &valueInfoFromEdge);
1628  }
1629 
1631  if (!N.getSummaryList().size()) // handle external function
1632  return FunctionSummary::ExternalNode.CallGraphEdgeList.begin();
1633 
1634  FunctionSummary *F =
1635  cast<FunctionSummary>(N.getSummaryList().front()->getBaseObject());
1636  return F->CallGraphEdgeList.begin();
1637  }
1638 
1640  if (!N.getSummaryList().size()) // handle external function
1641  return FunctionSummary::ExternalNode.CallGraphEdgeList.end();
1642 
1643  FunctionSummary *F =
1644  cast<FunctionSummary>(N.getSummaryList().front()->getBaseObject());
1645  return F->CallGraphEdgeList.end();
1646  }
1647 
1648  static NodeRef edge_dest(EdgeRef E) { return E.first; }
1649 };
1650 
1651 template <>
1654  std::unique_ptr<GlobalValueSummary> Root =
1655  std::make_unique<FunctionSummary>(I->calculateCallGraphRoot());
1656  GlobalValueSummaryInfo G(I->haveGVs());
1657  G.SummaryList.push_back(std::move(Root));
1658  static auto P =
1659  GlobalValueSummaryMapTy::value_type(GlobalValue::GUID(0), std::move(G));
1660  return ValueInfo(I->haveGVs(), &P);
1661  }
1662 };
1663 } // end namespace llvm
1664 
1665 #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:1031
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:648
llvm::const_gvsummary_iterator
GlobalValueSummaryMapTy::const_iterator const_gvsummary_iterator
Type used for iterating through the global value summary map.
Definition: ModuleSummaryIndex.h:1046
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:1371
llvm::ModuleSummaryIndex::hasSyntheticEntryCounts
bool hasSyntheticEntryCounts() const
Definition: ModuleSummaryIndex.h:1291
llvm::ModuleSummaryIndex::haveGVs
bool haveGVs() const
Definition: ModuleSummaryIndex.h:1191
llvm::DenseMapInfo< FunctionSummary::VFuncId >::isEqual
static bool isEqual(FunctionSummary::VFuncId L, FunctionSummary::VFuncId R)
Definition: ModuleSummaryIndex.h:846
MathExtras.h
llvm::GlobalValueSummaryInfo::NameOrGV::GV
const GlobalValue * GV
The GlobalValue corresponding to this summary.
Definition: ModuleSummaryIndex.h:139
llvm
This is an optimization pass for GlobalISel generic memory operations.
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:1337
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:1527
llvm::WholeProgramDevirtResolution::ByArg::TheKind
enum llvm::WholeProgramDevirtResolution::ByArg::Kind TheKind
llvm::GraphTraits< ValueInfo >::edge_dest
static NodeRef edge_dest(EdgeRef E)
Definition: ModuleSummaryIndex.h:1648
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:1608
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:1610
llvm::ModuleSummaryIndex::begin
const_gvsummary_iterator begin() const
Definition: ModuleSummaryIndex.h:1201
llvm::ModuleSummaryIndex::getModule
ModuleInfo * getModule(StringRef ModPath)
Return module entry for module with the given ModPath.
Definition: ModuleSummaryIndex.h:1489
llvm::ModuleSummaryIndex::ModuleInfo
ModulePathStringTableTy::value_type ModuleInfo
Definition: ModuleSummaryIndex.h:1479
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:1305
llvm::ModuleSummaryIndex::isReadOnly
bool isReadOnly(const GlobalVarSummary *GVS) const
Definition: ModuleSummaryIndex.h:1284
llvm::FunctionSummary::classof
static bool classof(const GlobalValueSummary *GVS)
Check if this is a function summary.
Definition: ModuleSummaryIndex.h:738
llvm::ModuleSummaryIndex::getModuleHash
const ModuleHash & getModuleHash(const StringRef ModPath) const
Get the module SHA1 hash recorded for the given module path.
Definition: ModuleSummaryIndex.h:1454
llvm::FunctionSummary::calls
ArrayRef< EdgeTy > calls() const
Return the list of <CalleeValueInfo, CalleeInfo> pairs.
Definition: ModuleSummaryIndex.h:759
llvm::ModuleSummaryIndex::setEnableSplitLTOUnit
void setEnableSplitLTOUnit()
Definition: ModuleSummaryIndex.h:1302
llvm::CalleeInfo::MaxRelBlockFreq
static constexpr uint64_t MaxRelBlockFreq
Definition: ModuleSummaryIndex.h:74
llvm::ModuleSummaryIndex::saveString
StringRef saveString(StringRef String)
Definition: ModuleSummaryIndex.h:1334
llvm::TypeTestResolution::Kind
Kind
Specifies which kind of type check we should emit for this byte array.
Definition: ModuleSummaryIndex.h:971
llvm::FunctionSummary::fflags
FFlags fflags() const
Get function summary flags.
Definition: ModuleSummaryIndex.h:743
llvm::FunctionSummary::paramAccesses
ArrayRef< ParamAccess > paramAccesses() const
Returns the list of known uses of pointer parameters.
Definition: ModuleSummaryIndex.h:810
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:894
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:631
llvm::GlobalVarSummary::setWriteOnly
void setWriteOnly(bool WO)
Definition: ModuleSummaryIndex.h:943
llvm::FunctionSummary::ParamAccess::Call::Offsets
ConstantRange Offsets
Definition: ModuleSummaryIndex.h:641
llvm::GraphTraits< ValueInfo >::child_edge_end
static ChildEdgeIteratorType child_edge_end(NodeRef N)
Definition: ModuleSummaryIndex.h:1639
llvm::GlobalValueSummary::setLive
void setLive(bool Live)
Definition: ModuleSummaryIndex.h:417
llvm::GraphTraits< ValueInfo >::ChildEdgeIteratorType
std::vector< FunctionSummary::EdgeTy >::iterator ChildEdgeIteratorType
Definition: ModuleSummaryIndex.h:1606
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:994
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:972
llvm::CalleeInfo::HotnessType::Cold
@ Cold
Allocator.h
llvm::ModuleSummaryIndex::end
const_gvsummary_iterator end() const
Definition: ModuleSummaryIndex.h:1203
llvm::FunctionSummary::setNoUnwind
void setNoUnwind()
Definition: ModuleSummaryIndex.h:747
llvm::GlobalVarSummary::GlobalVarSummary
GlobalVarSummary(GVFlags Flags, GVarFlags VarFlags, std::vector< ValueInfo > Refs)
Definition: ModuleSummaryIndex.h:931
llvm::ModuleSummaryIndex::getOrInsertTypeIdSummary
TypeIdSummary & getOrInsertTypeIdSummary(StringRef TypeId)
Return an existing or new TypeIdSummary entry for TypeId.
Definition: ModuleSummaryIndex.h:1507
llvm::FunctionSummary::addCall
void addCall(EdgeTy E)
Definition: ModuleSummaryIndex.h:763
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:976
llvm::VirtFuncOffset
The ValueInfo and offset for a function within a vtable definition initializer array.
Definition: ModuleSummaryIndex.h:875
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:795
llvm::VirtFuncOffset::VTableOffset
uint64_t VTableOffset
Definition: ModuleSummaryIndex.h:880
DenseMap.h
llvm::FunctionSummary::FFlags::operator&=
FFlags & operator&=(const FFlags &RHS)
Definition: ModuleSummaryIndex.h:591
Module.h
llvm::X86AS::FS
@ FS
Definition: X86.h:188
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:1073
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:1988
llvm::Optional
Definition: APInt.h:33
llvm::VirtFuncOffset::VirtFuncOffset
VirtFuncOffset(ValueInfo VI, uint64_t Offset)
Definition: ModuleSummaryIndex.h:876
llvm::GlobalVarSummary::getVCallVisibility
GlobalObject::VCallVisibility getVCallVisibility() const
Definition: ModuleSummaryIndex.h:950
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:332
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:1519
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:80
llvm::FunctionSummary::FSHT_AllNonCritical
@ FSHT_AllNonCritical
Definition: ModuleSummaryIndex.h:521
llvm::ModuleSummaryIndex::isGlobalValueLive
bool isGlobalValueLive(const GlobalValueSummary *GVS) const
Definition: ModuleSummaryIndex.h:1309
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
RHS
Value * RHS
Definition: X86PartialReduction.cpp:74
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:1474
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:1307
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:1202
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:1449
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:1596
F
#define F(x, y, z)
Definition: MD5.cpp:55
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:1281
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:879
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:1204
llvm::ValueInfo::ValueInfo
ValueInfo()=default
llvm::ModuleSummaryIndex::setWithAttributePropagation
void setWithAttributePropagation()
Definition: ModuleSummaryIndex.h:1277
llvm::GlobalValueSummary
Function and variable summary information to aid decisions and implementation of importing.
Definition: ModuleSummaryIndex.h:290
llvm::DenseMapInfo
An information struct used to provide DenseMap with the various necessary components for a given valu...
Definition: APInt.h:34
llvm::GlobalVarSummary::GVarFlags::MaybeWriteOnly
unsigned MaybeWriteOnly
Definition: ModuleSummaryIndex.h:916
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:1078
llvm::GlobalValue::VisibilityTypes
VisibilityTypes
An enumeration for the kinds of visibility of global values.
Definition: GlobalValue.h:62
llvm::GlobalVarSummary::GVarFlags
Definition: ModuleSummaryIndex.h:901
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:640
llvm::GlobalVarSummary::GVarFlags::VCallVisibility
unsigned VCallVisibility
Definition: ModuleSummaryIndex.h:928
SmallString.h
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::ModuleSummaryIndex::enableSplitLTOUnit
bool enableSplitLTOUnit() const
Definition: ModuleSummaryIndex.h:1301
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:639
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:768
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:777
llvm::WholeProgramDevirtResolution::ByArg::Kind
Kind
Definition: ModuleSummaryIndex.h:1009
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:1444
llvm::WholeProgramDevirtResolution::ByArg::Byte
uint32_t Byte
Definition: ModuleSummaryIndex.h:1025
llvm::GlobalVarSummary::isConstant
bool isConstant() const
Definition: ModuleSummaryIndex.h:946
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:761
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:661
llvm::getHotnessName
const char * getHotnessName(CalleeInfo::HotnessType HT)
Definition: ModuleSummaryIndex.h:106
llvm::GlobalVarSummary::maybeReadOnly
bool maybeReadOnly() const
Definition: ModuleSummaryIndex.h:944
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:1390
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:1498
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:1402
StringMap.h
llvm::ModuleSummaryIndex::withGlobalValueDeadStripping
bool withGlobalValueDeadStripping() const
Definition: ModuleSummaryIndex.h:1269
llvm::WholeProgramDevirtResolution::Kind
Kind
Definition: ModuleSummaryIndex.h:998
llvm::WholeProgramDevirtResolution::BranchFunnel
@ BranchFunnel
When retpoline mitigation is enabled, use a branch funnel that is defined in the merged module.
Definition: ModuleSummaryIndex.h:1001
llvm::ValueInfo::ReadOnly
@ ReadOnly
Definition: ModuleSummaryIndex.h:169
llvm::FunctionSummary::FFlags::anyFlagSet
bool anyFlagSet()
Definition: ModuleSummaryIndex.h:605
llvm::TypeTestResolution::BitMask
uint8_t BitMask
Definition: ModuleSummaryIndex.h:993
llvm::TypeTestResolution::Inline
@ Inline
Inlined bit vector ("Short Inline Bit Vectors")
Definition: ModuleSummaryIndex.h:974
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:828
llvm::ModuleSummaryIndex::setHasSyntheticEntryCounts
void setHasSyntheticEntryCounts()
Definition: ModuleSummaryIndex.h:1292
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:1000
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:991
llvm::GlobalVarSummary::setVCallVisibility
void setVCallVisibility(GlobalObject::VCallVisibility Vis)
Definition: ModuleSummaryIndex.h:947
llvm::WholeProgramDevirtResolution::SingleImplName
std::string SingleImplName
Definition: ModuleSummaryIndex.h:1006
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:1416
llvm::GlobalVarSummary::maybeWriteOnly
bool maybeWriteOnly() const
Definition: ModuleSummaryIndex.h:945
llvm::TypeTestResolution::Single
@ Single
Single element (last example in "Short Inline Bit Vectors")
Definition: ModuleSummaryIndex.h:975
llvm::WholeProgramDevirtResolution::ByArg::UniformRetVal
@ UniformRetVal
Uniform return value optimization.
Definition: ModuleSummaryIndex.h:1011
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:7658
llvm::WholeProgramDevirtResolution::ByArg::Indir
@ Indir
Just do a regular virtual call.
Definition: ModuleSummaryIndex.h:1010
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:959
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:999
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:1316
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:1353
llvm::DenseMap
Definition: DenseMap.h:714
llvm::ModuleSummaryIndex::getBlockCount
uint64_t getBlockCount() const
Definition: ModuleSummaryIndex.h:1196
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:883
llvm::DenseMapInfo< FunctionSummary::ConstVCall >::getTombstoneKey
static FunctionSummary::ConstVCall getTombstoneKey()
Definition: ModuleSummaryIndex.h:858
llvm::FunctionSummary::FFlags::MustBeUnreachable
unsigned MustBeUnreachable
Definition: ModuleSummaryIndex.h:589
I
#define I(x, y, z)
Definition: MD5.cpp:58
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:1620
llvm::ModuleSummaryIndex::setBlockCount
void setBlockCount(uint64_t C)
Definition: ModuleSummaryIndex.h:1198
llvm::GraphTraits< ModuleSummaryIndex * >::getEntryNode
static NodeRef getEntryNode(ModuleSummaryIndex *I)
Definition: ModuleSummaryIndex.h:1653
llvm::ModuleSummaryIndex::print
void print(raw_ostream &OS, bool IsForDebug=false) const
Print to an output stream.
Definition: AsmWriter.cpp:4794
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:1548
llvm::ModuleSummaryIndex::skipModuleByDistributedBackend
bool skipModuleByDistributedBackend() const
Definition: ModuleSummaryIndex.h:1294
llvm::FunctionSummary::makeDummyFunctionSummary
static FunctionSummary makeDummyFunctionSummary(std::vector< FunctionSummary::EdgeTy > Edges)
Create an empty FunctionSummary (with specified call edges).
Definition: ModuleSummaryIndex.h:668
llvm::WholeProgramDevirtResolution::ByArg::UniqueRetVal
@ UniqueRetVal
Unique return value optimization.
Definition: ModuleSummaryIndex.h:1012
ArrayRef.h
llvm::gvsummary_iterator
GlobalValueSummaryMapTy::iterator gvsummary_iterator
Definition: ModuleSummaryIndex.h:1047
llvm::TypeIdSummary
Definition: ModuleSummaryIndex.h:1034
llvm::TypeIdOffsetVtableInfo::TypeIdOffsetVtableInfo
TypeIdOffsetVtableInfo(uint64_t Offset, ValueInfo VI)
Definition: ModuleSummaryIndex.h:1074
llvm::ModuleSummaryIndex::modulePaths
const StringMap< std::pair< uint64_t, ModuleHash > > & modulePaths() const
Table of modules, containing module hash and id.
Definition: ModuleSummaryIndex.h:1439
llvm::ModuleSummaryIndex::addBlockCount
void addBlockCount(uint64_t C)
Definition: ModuleSummaryIndex.h:1197
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:1707
llvm::GlobalValueSummary::FunctionKind
@ FunctionKind
Definition: ModuleSummaryIndex.h:293
PreservedSymbols
static const char * PreservedSymbols[]
Definition: IRSymtab.cpp:44
llvm::ModuleSummaryIndex::getOrInsertValueInfo
ValueInfo getOrInsertValueInfo(GlobalValue::GUID GUID)
Return a ValueInfo for GUID.
Definition: ModuleSummaryIndex.h:1327
llvm::operator==
bool operator==(uint64_t V1, const APInt &V2)
Definition: APInt.h:1986
llvm::ModuleSummaryIndex::typeIds
const TypeIdSummaryMapTy & typeIds() const
Definition: ModuleSummaryIndex.h:1502
llvm::ModuleSummaryIndex::setWithDSOLocalPropagation
void setWithDSOLocalPropagation()
Definition: ModuleSummaryIndex.h:1282
llvm::ModuleSummaryIndex::begin
gvsummary_iterator begin()
Definition: ModuleSummaryIndex.h:1200
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
llvm::ModuleSummaryIndex::cfiFunctionDefs
std::set< std::string > & cfiFunctionDefs()
Definition: ModuleSummaryIndex.h:1358
llvm::ModuleSummaryIndex::ModuleSummaryIndex
ModuleSummaryIndex(bool HaveGVs, bool EnableSplitLTOUnit=false)
Definition: ModuleSummaryIndex.h:1175
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:1304
llvm::DenseMapInfo< FunctionSummary::VFuncId >::getEmptyKey
static FunctionSummary::VFuncId getEmptyKey()
Definition: ModuleSummaryIndex.h:840
llvm::FunctionSummary::setParamAccesses
void setParamAccesses(std::vector< ParamAccess > NewParams)
Sets the list of known uses of pointer parameters.
Definition: ModuleSummaryIndex.h:817
llvm::FunctionSummary::instCount
unsigned instCount() const
Get the instruction count recorded for this function.
Definition: ModuleSummaryIndex.h:750
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:531
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:57
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:1321
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:1564
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:644
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:966
llvm::TypeIdCompatibleVtableInfo
std::vector< TypeIdOffsetVtableInfo > TypeIdCompatibleVtableInfo
List of vtable definitions decorated by a particular type identifier, and their corresponding offsets...
Definition: ModuleSummaryIndex.h:1084
llvm::ModuleSummaryIndex::cfiFunctionDecls
std::set< std::string > & cfiFunctionDecls()
Definition: ModuleSummaryIndex.h:1361
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:753
llvm::TypeTestResolution::TheKind
enum llvm::TypeTestResolution::Kind TheKind
llvm::TypeTestResolution::Unknown
@ Unknown
Unknown (analysis not performed, don't lower)
Definition: ModuleSummaryIndex.h:978
ScaledNumber.h
llvm::GlobalVarSummary::setVTableFuncs
void setVTableFuncs(VTableFuncList Funcs)
Definition: ModuleSummaryIndex.h:954
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:1676
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:925
llvm::DenseMapInfo< FunctionSummary::VFuncId >::getHashValue
static unsigned getHashValue(FunctionSummary::VFuncId I)
Definition: ModuleSummaryIndex.h:850
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:786
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:1362
llvm::ScaledNumber< uint64_t >
llvm::DenseMapInfo< FunctionSummary::ConstVCall >::getEmptyKey
static FunctionSummary::ConstVCall getEmptyKey()
Definition: ModuleSummaryIndex.h:854
llvm::FunctionSummary::ExternalNode
static FunctionSummary ExternalNode
A dummy node to reference external functions that aren't in the index.
Definition: ModuleSummaryIndex.h:686
llvm::GlobalVarSummary::varflags
GVarFlags varflags() const
Definition: ModuleSummaryIndex.h:941
llvm::WholeProgramDevirtResolution::ByArg
Definition: ModuleSummaryIndex.h:1008
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:992
llvm::ModuleSummaryIndex::setWithGlobalValueDeadStripping
void setWithGlobalValueDeadStripping()
Definition: ModuleSummaryIndex.h:1272
llvm::GlobalObject::VCallVisibility
VCallVisibility
Definition: GlobalObject.h:32
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:658
llvm::FunctionSummary::ParamAccess::RangeWidth
static constexpr uint32_t RangeWidth
Definition: ModuleSummaryIndex.h:633
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:1240
llvm::ModuleSummaryIndex::cfiFunctionDefs
const std::set< std::string > & cfiFunctionDefs() const
Definition: ModuleSummaryIndex.h:1359
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:1533
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:842
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:1020
llvm::WholeProgramDevirtResolution::ByArg::VirtualConstProp
@ VirtualConstProp
Virtual constant propagation.
Definition: ModuleSummaryIndex.h:1013
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:1426
llvm::FunctionSummary::FFlags::MayThrow
unsigned MayThrow
Definition: ModuleSummaryIndex.h:579
llvm::FunctionSummary::setNoRecurse
void setNoRecurse()
Definition: ModuleSummaryIndex.h:745
llvm::GlobalVarSummary::setReadOnly
void setReadOnly(bool RO)
Definition: ModuleSummaryIndex.h:942
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:1869
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:1184
llvm::ModuleSummaryIndex::dump
void dump() const
Dump to stderr (for debugging).
Definition: AsmWriter.cpp:4856
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:1039
llvm::WholeProgramDevirtResolution::TheKind
enum llvm::WholeProgramDevirtResolution::Kind TheKind
llvm::ModuleSummaryIndex::isWriteOnly
bool isWriteOnly(const GlobalVarSummary *GVS) const
Definition: ModuleSummaryIndex.h:1287
llvm::GlobalVarSummary::classof
static bool classof(const GlobalValueSummary *GVS)
Check if this is a global variable summary.
Definition: ModuleSummaryIndex.h:937
llvm::ModuleSummaryIndex::setSkipModuleByDistributedBackend
void setSkipModuleByDistributedBackend()
Definition: ModuleSummaryIndex.h:1297
llvm::ModuleSummaryIndex::addGlobalValueSummary
void addGlobalValueSummary(const GlobalValue &GV, std::unique_ptr< GlobalValueSummary > Summary)
Add a global value summary for a value.
Definition: ModuleSummaryIndex.h:1365
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:803
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:1630
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:1599
llvm::TypeIdSummary::TTRes
TypeTestResolution TTRes
Definition: ModuleSummaryIndex.h:1035
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:1088
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:1462
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:632
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:1345
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:638
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:902
llvm::TypeIdOffsetVtableInfo::AddressPointOffset
uint64_t AddressPointOffset
Definition: ModuleSummaryIndex.h:1077
llvm::GlobalValueSummary::~GlobalValueSummary
virtual ~GlobalValueSummary()=default
llvm::WholeProgramDevirtResolution
Definition: ModuleSummaryIndex.h:997
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:756
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:1276
llvm::ModuleSummaryIndex::addGlobalValueSummary
void addGlobalValueSummary(ValueInfo VI, std::unique_ptr< GlobalValueSummary > Summary)
Add a global value summary for the given ValueInfo.
Definition: ModuleSummaryIndex.h:1378
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:1208
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:711
llvm::TypeTestResolution::ByteArray
@ ByteArray
Test a byte array (first example)
Definition: ModuleSummaryIndex.h:973
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:1061
llvm::DenseMapInfo< FunctionSummary::ConstVCall >::getHashValue
static unsigned getHashValue(FunctionSummary::ConstVCall I)
Definition: ModuleSummaryIndex.h:868
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:1043
llvm::raw_string_ostream::str
std::string & str()
Returns the string's reference.
Definition: raw_ostream.h:649
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:1597
llvm::WholeProgramDevirtResolution::ByArg::Bit
uint32_t Bit
Definition: ModuleSummaryIndex.h:1026
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:1483
llvm::FunctionSummary::getTypeIdInfo
const TypeIdInfo * getTypeIdInfo() const
Definition: ModuleSummaryIndex.h:834
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:912
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:984
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:862
llvm::GraphTraits< ValueInfo >
GraphTraits definition to build SCC for the index.
Definition: ModuleSummaryIndex.h:1595
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:1541
llvm::ModuleSummaryIndex::getRegularLTOModuleName
static constexpr const char * getRegularLTOModuleName()
Definition: ModuleSummaryIndex.h:1187