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