LLVM: include/llvm/IR/ModuleSummaryIndex.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15#ifndef LLVM_IR_MODULESUMMARYINDEX_H

16#define LLVM_IR_MODULESUMMARYINDEX_H

17

37#include

38#include

39#include

40#include

41#include

42#include

43#include

44#include

45#include

46#include

47#include <unordered_set>

48#include

49#include

50

51namespace llvm {

52

53template struct GraphTraits;

54

55namespace yaml {

56

58

59}

60

61

70

71

72

74

75

78

79

80

85

92

96

98

100

102

103

104

105

106

107

109 if (EntryFreq == 0)

110 return;

112 Scaled64 Temp(BlockFreq, ScaleShift);

113 Temp /= Scaled64::get(EntryFreq);

114

119 }

120};

121

123 switch (HT) {

125 return "unknown";

127 return "cold";

129 return "none";

131 return "hot";

133 return "critical";

134 }

136}

137

138class GlobalValueSummary;

139

141

145 if (HaveGVs)

146 GV = nullptr;

147 else

149 }

150

151

152

153

154

156

157

158

159

160

161

164

166

167

168

170 return SummaryList;

171 }

172

173

174

175 inline void addSummary(std::unique_ptr Summary);

176

177

178

180

181 bool hasLocal() const { return HasLocal; }

182

183private:

184

185

186

187

188

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205 bool HasLocal : 1;

206};

207

208

209

210

211

212

213

215 std::map<GlobalValue::GUID, GlobalValueSummaryInfo>;

216

217

218

223

225 ValueInfo(bool HaveGVs, const GlobalValueSummaryMapTy::value_type *R) {

228 }

229

230 explicit operator bool() const { return getRef(); }

231

235 return getRef()->second.U.GV;

236 }

237

239 return getRef()->second.getSummaryList();

240 }

241

243

245

246

247

249

255

271 return (RefAndFlags.getInt() & BadAccessMask) != BadAccessMask;

272 }

283

284 const GlobalValueSummaryMapTy::value_type *getRef() const {

286 }

287

288

289

290

292

293

294

295 LLVM_ABI bool isDSOLocal(bool WithDSOLocalPropagation = false) const;

296

297

299};

300

302 OS << VI.getGUID();

303 if (!VI.name().empty())

304 OS << " (" << VI.name() << ")";

305 return OS;

306}

307

309 assert(A.getRef() && B.getRef() &&

310 "Need ValueInfo with non-null Ref for comparison");

311 return A.getRef() == B.getRef();

312}

313

315 assert(A.getRef() && B.getRef() &&

316 "Need ValueInfo with non-null Ref for comparison");

317 return A.getRef() != B.getRef();

318}

319

321 assert(A.getRef() && B.getRef() &&

322 "Need ValueInfo with non-null Ref to compare GUIDs");

323 return A.getGUID() < B.getGUID();

324}

325

328 return ValueInfo(false, (GlobalValueSummaryMapTy::value_type *)-8);

329 }

330

332 return ValueInfo(false, (GlobalValueSummaryMapTy::value_type *)-16);

333 }

334

338

340

341

343 return L.getRef() == R.getRef();

344 }

346};

347

348

349

350

355

356

358

360

361

362

363

364

365

366

367

368

370

371

372

373

374

376

383};

384

386 OS << "Callee: " << SNI.Callee;

389 return OS;

390}

391

392

393

394

395

396

404

405

407

409

410

411

412

413

415

418};

419

425

426

428

429

430

431

432

433

434

435

437

438

439 std::vector MIBs;

440

441

442

443

444

445

446

448

454};

455

457 bool First = true;

458 OS << "Versions: ";

461 OS << ", ";

464 }

465 OS << " MIB:\n";

466 for (auto &M : AE.MIBs) {

467 OS << "\t\t" << M << "\n";

468 }

470 OS << "\tContextSizeInfo per MIB:\n";

472 OS << "\t\t";

473 bool FirstInfo = true;

474 for (auto [FullStackId, TotalSize] : Infos) {

475 if (!FirstInfo)

476 OS << ", ";

477 FirstInfo = false;

478 OS << "{ " << FullStackId << ", " << TotalSize << " }";

479 }

480 OS << "\n";

481 }

482 }

483 return OS;

484}

485

486

487

489public:

490

492

494

495

497

498

499

500

501

503 };

504

505

507

508

509

510

511

512

513

515

516

518

519

520

522

523

524

525

526

527

529

530

531

533

534

535

536

537

538

539

540

541

542

544

545

546

548

549

558 };

559

560private:

561

562 SummaryKind Kind;

563

564 GVFlags Flags;

565

566

567

568

570

571

572

573

574

575

576

577

579

580

581

582

583

584

585

587

588protected:

591 : Kind(K), Flags(Flags), RefEdgeList(std::move(Refs)) {

593 "Expect no references for AliasSummary");

594 }

595

596public:

598

599

600

602

603

605

606

608

609

610

612

613

615

616

618

619

623

624

625

629

630

632

633 bool isLive() const { return Flags.Live; }

634

635 void setLive(bool Live) { Flags.Live = Live; }

636

638

639 bool isDSOLocal() const { return Flags.DSOLocal; }

640

641 void setCanAutoHide(bool CanAutoHide) { Flags.CanAutoHide = CanAutoHide; }

642

643 bool canAutoHide() const { return Flags.CanAutoHide; }

644

648

650

652 return static_cast<ImportKind>(Flags.ImportType);

653 }

654

659 Flags.Visibility = (unsigned)Vis;

660 }

661

662

664

665

667

668

669

672

674};

675

677 : U(HaveGVs), HasLocal(false) {}

678

680 std::unique_ptr Summary) {

682 HasLocal = true;

683 return SummaryList.push_back(std::move(Summary));

684}

685

689 [](const std::unique_ptr &Summary) {

691 }));

692}

693

694

697

698

699

700

701

703

704public:

707

708

712

714 AliaseeValueInfo = AliaseeVI;

715 AliaseeSummary = Aliasee;

716 }

717

719 assert(!!AliaseeSummary == (AliaseeValueInfo &&

720 !AliaseeValueInfo.getSummaryList().empty()) &&

721 "Expect to have both aliasee summary and summary list or neither");

722 return !!AliaseeSummary;

723 }

724

726 assert(AliaseeSummary && "Unexpected missing aliasee summary");

727 return *AliaseeSummary;

728 }

729

732 static_cast<const AliasSummary *>(this)->getAliasee());

733 }

735 assert(AliaseeValueInfo && "Unexpected missing aliasee");

736 return AliaseeValueInfo;

737 }

739 assert(AliaseeValueInfo && "Unexpected missing aliasee");

740 return AliaseeValueInfo.getGUID();

741 }

742};

743

746 return &AS->getAliasee();

747 return this;

748}

749

752 return &AS->getAliasee();

753 return this;

754}

755

756

757

759public:

760

761 using EdgeTy = std::pair<ValueInfo, CalleeInfo>;

762

763

769

770

771

772

773

778

779

780

781

784 std::vector<uint64_t> Args;

785 };

786

787

788

790

791

792

794

795

796

797

799

800

801

802

805 };

806

807

809

810

815

816

818

820

821

823

825

826

828

829

830

831

832

833

835

849

856

857 operator std::string() {

858 std::string Output;

860 OS << "funcFlags: (";

861 OS << "readNone: " << this->ReadNone;

862 OS << ", readOnly: " << this->ReadOnly;

863 OS << ", noRecurse: " << this->NoRecurse;

865 OS << ", noInline: " << this->NoInline;

866 OS << ", alwaysInline: " << this->AlwaysInline;

867 OS << ", noUnwind: " << this->NoUnwind;

868 OS << ", mayThrow: " << this->MayThrow;

871 OS << ")";

872 return Output;

873 }

874 };

875

876

879

880

881

882

892

894

895

896

897

899

900

901

902

904

908 };

909

910

911

918 true, true, false,

921 std::move(Edges), std::vectorGlobalValue::GUID(),

922 std::vectorFunctionSummary::VFuncId(),

923 std::vectorFunctionSummary::VFuncId(),

924 std::vectorFunctionSummary::ConstVCall(),

925 std::vectorFunctionSummary::ConstVCall(),

926 std::vectorFunctionSummary::ParamAccess(),

927 std::vector(), std::vector());

928 }

929

930

932

933private:

934

935

936 unsigned InstCount;

937

938

940

941

942

943

945

946 std::unique_ptr TIdInfo;

947

948

949 using ParamAccessesTy = std::vector;

950 std::unique_ptr ParamAccesses;

951

952

953

954

955

956

957

958 using CallsitesTy = std::vector;

959 std::unique_ptr Callsites;

960

961

962

963

964

965

966

967

968 using AllocsTy = std::vector;

969 std::unique_ptr Allocs;

970

971public:

975 std::vectorGlobalValue::GUID TypeTests,

976 std::vector TypeTestAssumeVCalls,

977 std::vector TypeCheckedLoadVCalls,

978 std::vector TypeTestAssumeConstVCalls,

979 std::vector TypeCheckedLoadConstVCalls,

980 std::vector Params, CallsitesTy CallsiteList,

981 AllocsTy AllocList)

983 InstCount(NumInsts), FunFlags(FunFlags),

984 CallGraphEdgeList(std::move(CGEdges)) {

985 if (!TypeTests.empty() || !TypeTestAssumeVCalls.empty() ||

986 !TypeCheckedLoadVCalls.empty() || !TypeTestAssumeConstVCalls.empty() ||

987 !TypeCheckedLoadConstVCalls.empty())

988 TIdInfo = std::make_unique(

989 TypeIdInfo{std::move(TypeTests), std::move(TypeTestAssumeVCalls),

990 std::move(TypeCheckedLoadVCalls),

991 std::move(TypeTestAssumeConstVCalls),

992 std::move(TypeCheckedLoadConstVCalls)});

993 if (!Params.empty())

994 ParamAccesses = std::make_unique(std::move(Params));

995 if (!CallsiteList.empty())

996 Callsites = std::make_unique(std::move(CallsiteList));

997 if (!AllocList.empty())

998 Allocs = std::make_unique(std::move(AllocList));

999 }

1000

1002

1003

1007

1008

1010

1012

1014

1015

1016 unsigned instCount() const { return InstCount; }

1017

1018

1020

1022

1024

1025

1026

1027

1029 if (TIdInfo)

1030 return TIdInfo->TypeTests;

1031 return {};

1032 }

1033

1034

1035

1036

1038 if (TIdInfo)

1039 return TIdInfo->TypeTestAssumeVCalls;

1040 return {};

1041 }

1042

1043

1044

1045

1047 if (TIdInfo)

1048 return TIdInfo->TypeCheckedLoadVCalls;

1049 return {};

1050 }

1051

1052

1053

1054

1056 if (TIdInfo)

1057 return TIdInfo->TypeTestAssumeConstVCalls;

1058 return {};

1059 }

1060

1061

1062

1064 if (TIdInfo)

1065 return TIdInfo->TypeCheckedLoadConstVCalls;

1066 return {};

1067 }

1068

1069

1071 if (ParamAccesses)

1072 return *ParamAccesses;

1073 return {};

1074 }

1075

1076

1078 if (NewParams.empty())

1079 ParamAccesses.reset();

1080 else if (ParamAccesses)

1081 *ParamAccesses = std::move(NewParams);

1082 else

1083 ParamAccesses = std::make_unique(std::move(NewParams));

1084 }

1085

1086

1087

1089 if (!TIdInfo)

1090 TIdInfo = std::make_unique();

1091 TIdInfo->TypeTests.push_back(Guid);

1092 }

1093

1095

1097 if (Callsites)

1098 return *Callsites;

1099 return {};

1100 }

1101

1104 return *Callsites;

1105 }

1106

1108 if (!Callsites)

1109 Callsites = std::make_unique();

1110 Callsites->push_back(Callsite);

1111 }

1112

1114 if (Allocs)

1115 return *Allocs;

1116 return {};

1117 }

1118

1121 return *Allocs;

1122 }

1123

1125};

1126

1129

1133

1135 return L.GUID == R.GUID && L.Offset == R.Offset;

1136 }

1137

1139};

1140

1143 return {{0, uint64_t(-1)}, {}};

1144 }

1145

1147 return {{0, uint64_t(-2)}, {}};

1148 }

1149

1153 L.Args == R.Args;

1154 }

1155

1157 return I.VFunc.GUID;

1158 }

1159};

1160

1161

1162

1170

1172

1173

1174

1175

1176

1177

1178

1179

1180

1181

1183private:

1184

1185

1186 std::unique_ptr VTableFuncs;

1187

1188public:

1194

1195

1196

1197

1198

1199

1201

1202

1203

1205

1206

1207

1208

1209

1210

1211

1212

1214

1215

1218

1223

1224

1228

1236 VarFlags.VCallVisibility = Vis;

1237 }

1241

1243 assert(!VTableFuncs);

1244 VTableFuncs = std::make_unique(std::move(Funcs));

1245 }

1246

1248 if (VTableFuncs)

1249 return *VTableFuncs;

1250 return {};

1251 }

1252};

1253

1255

1256

1257

1258

1268

1269

1270

1271

1273

1274

1275

1276

1277

1278

1283};

1284

1293

1295

1303

1304

1305

1306

1307

1309

1310

1311

1312

1315 };

1316

1317

1318

1320};

1321

1324

1325

1326

1327 std::map<uint64_t, WholeProgramDevirtResolution> WPDRes;

1328};

1329

1332 using IndexIterator =

1335 using NestedIterator = std::set<std::string, std::less<>>::const_iterator;

1336

1337public:

1338

1340 std::forward_iterator_tag,

1341 GlobalValue::GUID> {

1343

1344 public:

1347

1349 };

1350

1353 for (; B != E; ++B)

1355 }

1356

1357 std::vector symbols() const {

1358 std::vector Symbols;

1359 for (auto &[GUID, Syms] : Index) {

1360 (void)GUID;

1362 }

1363 return Symbols;

1364 }

1365

1371

1373 auto I = Index.find(GUID);

1374 if (I == Index.end())

1375 return make_range(NestedIterator{}, NestedIterator{});

1376 return make_range(I->second.begin(), I->second.end());

1377 }

1378

1379 template <typename... Args> void emplace(Args &&...A) {

1380 StringRef S(std::forward(A)...);

1383 Index[GUID].emplace(S);

1384 }

1385

1389 auto I = Index.find(GUID);

1390 if (I == Index.end())

1391 return 0;

1392 return I->second.count(S);

1393 }

1394

1395 bool empty() const { return Index.empty(); }

1396};

1397

1398

1400

1401

1404

1405

1406

1408

1409

1410

1412

1413

1414

1416 std::map<std::string, GVSummaryMapTy, std::less<>>;

1417

1418

1420

1421

1422

1424 std::multimap<GlobalValue::GUID, std::pair<StringRef, TypeIdSummary>>;

1425

1426

1427

1428

1429

1430

1431

1432

1433

1434

1435

1443

1444

1445

1446

1448

1449

1450

1452private:

1453

1454

1456

1457

1459

1462

1463

1464

1466

1467

1468

1469

1470

1471 std::map<StringRef, TypeIdCompatibleVtableInfo, std::less<>>

1472 TypeIdCompatibleVtableMap;

1473

1474

1475

1477

1478

1479

1480

1481 bool WithGlobalValueDeadStripping = false;

1482

1483

1484

1485

1486 bool WithAttributePropagation = false;

1487

1488

1489

1490 bool WithDSOLocalPropagation = false;

1491

1492

1493 bool WithInternalizeAndPromote = false;

1494

1495

1496 bool WithWholeProgramVisibility = false;

1497

1498

1499 bool HasSyntheticEntryCounts = false;

1500

1501

1502 bool WithSupportsHotColdNew = false;

1503

1504

1505

1506

1507

1508

1509 bool SkipModuleByDistributedBackend = false;

1510

1511

1512

1513

1514

1515 bool HaveGVs;

1516

1517

1518 bool EnableSplitLTOUnit;

1519

1520

1521 bool UnifiedLTO;

1522

1523

1524

1525 bool PartiallySplitLTOUnits = false;

1526

1527

1528 bool HasParamAccess = false;

1529

1532

1533

1534

1537

1538

1539

1540

1541

1542

1543

1544

1546

1547

1548

1549

1550

1551 std::vector<uint64_t> StackIds;

1552

1553

1554

1556

1557

1559

1560 GlobalValueSummaryMapTy::value_type *

1563 .first;

1564 }

1565

1566public:

1567

1569 bool UnifiedLTO = false)

1570 : TypeIdSaver(TypeIdSaverAlloc), HaveGVs(HaveGVs),

1571 EnableSplitLTOUnit(EnableSplitLTOUnit), UnifiedLTO(UnifiedLTO),

1572 Saver(Alloc) {}

1573

1574

1575

1576

1577

1578

1580

1581

1583 return "[Regular LTO]";

1584 }

1585

1586 bool haveGVs() const { return HaveGVs; }

1587

1590

1594

1599 size_t size() const { return GlobalValueMap.size(); }

1600

1601 const std::vector<uint64_t> &stackIds() const { return StackIds; }

1602

1604 auto Inserted = StackIdToIndex.insert({StackId, StackIds.size()});

1605 if (Inserted.second)

1606 StackIds.push_back(StackId);

1607 return Inserted.first->second;

1608 }

1609

1611 assert(StackIds.size() > Index);

1612 return StackIds[Index];

1613 }

1614

1615

1616

1617

1618

1619

1621 assert(StackIdToIndex.size() == StackIds.size());

1622 StackIdToIndex.clear();

1623 StackIds.shrink_to_fit();

1624 }

1625

1626

1627

1629 std::map<ValueInfo, bool> &FunctionHasParent) {

1630 if (!V.getSummaryList().size())

1631 return;

1632

1633

1634 auto S = FunctionHasParent.emplace(V, false);

1635

1636

1637 if (!S.second)

1638 return;

1639

1642 assert(F != nullptr && "Expected FunctionSummary node");

1643

1644 for (const auto &C : F->calls()) {

1645

1646 auto S = FunctionHasParent.emplace(C.first, true);

1647

1648

1649 if (!S.second && S.first->second)

1650 continue;

1651

1652 if (S.second)

1654 else

1655 S.first->second = true;

1656 }

1657 }

1658

1659

1661

1662

1663

1664 std::map<ValueInfo, bool> FunctionHasParent;

1665

1666 for (auto &S : *this) {

1667

1668 if (!S.second.getSummaryList().size() ||

1670 continue;

1672 }

1673

1675

1676 for (auto &P : FunctionHasParent) {

1677 if (P.second)

1678 continue;

1680 }

1682 }

1683

1685 return WithGlobalValueDeadStripping;

1686 }

1688 WithGlobalValueDeadStripping = true;

1689 }

1690

1693 WithAttributePropagation = true;

1694 }

1695

1698

1701

1704

1706 return WithAttributePropagation && GVS->maybeReadOnly();

1707 }

1711

1714

1716 return SkipModuleByDistributedBackend;

1717 }

1719 SkipModuleByDistributedBackend = true;

1720 }

1721

1724

1727

1730

1732

1734 return !WithGlobalValueDeadStripping || GVS->isLive();

1735 }

1737

1738

1739

1743

1744

1746 auto I = GlobalValueMap.find(GUID);

1747 return ValueInfo(HaveGVs, I == GlobalValueMap.end() ? nullptr : &*I);

1748 }

1749

1750

1752 return ValueInfo(HaveGVs, getOrInsertValuePtr(GUID));

1753 }

1754

1755

1756

1757

1759

1760

1763 auto VP = getOrInsertValuePtr(GUID);

1764 VP->second.U.Name = Name;

1766 }

1767

1768

1771 auto VP = getOrInsertValuePtr(GV->getGUID());

1772 VP->second.U.GV = GV;

1774 }

1775

1776

1778 const auto I = OidGuidMap.find(OriginalID);

1779 return I == OidGuidMap.end() ? 0 : I->second;

1780 }

1781

1784

1787

1788

1790 std::unique_ptr Summary) {

1792 }

1793

1794

1796 std::unique_ptr Summary) {

1800 std::move(Summary));

1801 }

1802

1803

1805 std::unique_ptr Summary) {

1807 HasParamAccess |= !FS->paramAccesses().empty();

1808 addOriginalName(VI.getGUID(), Summary->getOriginalName());

1809

1810

1811 const_cast<GlobalValueSummaryMapTy::value_type *>(VI.getRef())

1812 ->second.addSummary(std::move(Summary));

1813 }

1814

1815

1818 if (OrigGUID == 0 || ValueGUID == OrigGUID)

1819 return;

1820 auto [It, Inserted] = OidGuidMap.try_emplace(OrigGUID, ValueGUID);

1821 if (!Inserted && It->second != ValueGUID)

1822 It->second = 0;

1823 }

1824

1825

1826

1828 auto SummaryList = VI.getSummaryList();

1829 auto Summary =

1831 [&](const std::unique_ptr &Summary) {

1832 return Summary->modulePath() == ModuleId;

1833 });

1834 if (Summary == SummaryList.end())

1835 return nullptr;

1836 return Summary->get();

1837 }

1838

1839

1840

1845 return nullptr;

1847 }

1848

1849

1850

1852 bool PerModuleIndex = true) const {

1853 assert(GV.hasName() && "Can't get GlobalValueSummary for GV with no name");

1855 }

1856

1857

1858

1859

1862 bool PerModuleIndex = true) const;

1863

1864

1866 return ModulePathStringTable;

1867 }

1868

1869

1871

1872

1874 auto It = ModulePathStringTable.find(ModPath);

1875 assert(It != ModulePathStringTable.end() && "Module not registered");

1876 return It->second;

1877 }

1878

1879

1880

1882 std::string Suffix = utostr((uint64_t(ModHash[0]) << 32) |

1883 ModHash[1]);

1885 }

1886

1889 NewName += ".llvm.";

1890 NewName += Suffix;

1891 return std::string(NewName);

1892 }

1893

1894

1895

1896

1897

1899 std::pair<StringRef, StringRef> Pair = Name.rsplit(".llvm.");

1900 return Pair.first;

1901 }

1902

1904

1905

1906

1908 return &*ModulePathStringTable.insert({ModPath, Hash}).first;

1909 }

1910

1911

1913 auto It = ModulePathStringTable.find(ModPath);

1914 assert(It != ModulePathStringTable.end() && "Module not registered");

1915 return &*It;

1916 }

1917

1918

1920 auto It = ModulePathStringTable.find(ModPath);

1921 assert(It != ModulePathStringTable.end() && "Module not registered");

1922 return &*It;

1923 }

1924

1925

1926

1927

1929 return ModulePathStringTable.count(M.getModuleIdentifier());

1930 }

1931

1933

1934

1935

1936

1938 auto TidIter = TypeIdMap.equal_range(

1940 for (auto &[GUID, TypeIdPair] : make_range(TidIter))

1941 if (TypeIdPair.first == TypeId)

1942 return TypeIdPair.second;

1943 auto It =

1946 return It->second.second;

1947 }

1948

1949

1950

1952 auto TidIter = TypeIdMap.equal_range(

1954 for (const auto &[GUID, TypeIdPair] : make_range(TidIter))

1955 if (TypeIdPair.first == TypeId)

1956 return &TypeIdPair.second;

1957 return nullptr;

1958 }

1959

1965

1967 return TypeIdCompatibleVtableMap;

1968 }

1969

1970

1971

1972

1975 return TypeIdCompatibleVtableMap[TypeIdSaver.save(TypeId)];

1976 }

1977

1978

1979

1980 std::optional

1982 auto I = TypeIdCompatibleVtableMap.find(TypeId);

1983 if (I == TypeIdCompatibleVtableMap.end())

1984 return std::nullopt;

1985 return I->second;

1986 }

1987

1988

1989

1993

1994

1995

1996 template

1997 void

1999 for (const auto &GlobalList : *this) {

2000 auto GUID = GlobalList.first;

2001 for (const auto &Summary : GlobalList.second.getSummaryList()) {

2002 ModuleToDefinedGVSummaries[Summary->modulePath()][GUID] = Summary.get();

2003 }

2004 }

2005 }

2006

2007

2009

2010

2012

2013

2017

2018

2020

2021

2024

2025

2027 bool AnalyzeRefs) const;

2028

2029

2030

2032 bool AnalyzeRefs, bool &CanImportDecl) const;

2033};

2034

2035

2039

2041 return P.first;

2042 }

2046

2049

2051

2053 if (N.getSummaryList().size())

2060 }

2061

2063 if (N.getSummaryList().size())

2070 }

2071

2073 if (N.getSummaryList().size())

2075

2078 return F->CallGraphEdgeList.begin();

2079 }

2080

2082 if (N.getSummaryList().size())

2084

2087 return F->CallGraphEdgeList.end();

2088 }

2089

2091};

2092

2093template <>

2096 std::unique_ptr Root =

2097 std::make_unique(I->calculateCallGraphRoot());

2099 G.addSummary(std::move(Root));

2100 static auto P =

2101 GlobalValueSummaryMapTy::value_type(GlobalValue::GUID(0), std::move(G));

2103 }

2104};

2105}

2106

2107#endif

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

This file defines the StringMap class.

This file defines the BumpPtrAllocator interface.

static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")

static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")

static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")

#define LLVM_PREFERRED_TYPE(T)

\macro LLVM_PREFERRED_TYPE Adjust type of bit-field in debug info.

This file defines the DenseMap class.

Module.h This file contains the declarations for the Module class.

This file defines the SmallString class.

This file defines the SmallVector class.

GlobalValue::GUID getAliaseeGUID() const

Definition ModuleSummaryIndex.h:738

const GlobalValueSummary & getAliasee() const

Definition ModuleSummaryIndex.h:725

ValueInfo getAliaseeVI() const

Definition ModuleSummaryIndex.h:734

static bool classof(const GlobalValueSummary *GVS)

Check if this is an alias summary.

Definition ModuleSummaryIndex.h:709

AliasSummary(GVFlags Flags)

Definition ModuleSummaryIndex.h:705

bool hasAliasee() const

Definition ModuleSummaryIndex.h:718

GlobalValueSummary & getAliasee()

Definition ModuleSummaryIndex.h:730

void setAliasee(ValueInfo &AliaseeVI, GlobalValueSummary *Aliasee)

Definition ModuleSummaryIndex.h:713

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

GUIDIterator(IndexIterator I)

Definition ModuleSummaryIndex.h:1346

GlobalValue::GUID operator*() const

Definition ModuleSummaryIndex.h:1348

GUIDIterator guid_end() const

Definition ModuleSummaryIndex.h:1367

void emplace(Args &&...A)

Definition ModuleSummaryIndex.h:1379

size_t count(StringRef S) const

Definition ModuleSummaryIndex.h:1386

std::vector< StringRef > symbols() const

Definition ModuleSummaryIndex.h:1357

iterator_range< GUIDIterator > guids() const

Definition ModuleSummaryIndex.h:1368

CfiFunctionIndex()=default

CfiFunctionIndex(It B, It E)

Definition ModuleSummaryIndex.h:1352

bool empty() const

Definition ModuleSummaryIndex.h:1395

iterator_range< NestedIterator > forGuid(GlobalValue::GUID GUID) const

Definition ModuleSummaryIndex.h:1372

GUIDIterator guid_begin() const

Definition ModuleSummaryIndex.h:1366

This class represents a range of values.

Implements a dense probed hash-table based set.

Function summary information to aid decisions and implementation of importing.

Definition ModuleSummaryIndex.h:758

static LLVM_ABI FunctionSummary ExternalNode

A dummy node to reference external functions that aren't in the index.

Definition ModuleSummaryIndex.h:931

void addCallsite(CallsiteInfo &Callsite)

Definition ModuleSummaryIndex.h:1107

static FunctionSummary makeDummyFunctionSummary(SmallVectorImpl< FunctionSummary::EdgeTy > &&Edges)

Create an empty FunctionSummary (with specified call edges).

Definition ModuleSummaryIndex.h:913

FunctionSummary(GVFlags Flags, unsigned NumInsts, FFlags FunFlags, SmallVectorImpl< ValueInfo > &&Refs, SmallVectorImpl< 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, CallsitesTy CallsiteList, AllocsTy AllocList)

Definition ModuleSummaryIndex.h:972

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:1037

AllocsTy & mutableAllocs()

Definition ModuleSummaryIndex.h:1119

void setNoRecurse()

Definition ModuleSummaryIndex.h:1011

void addCall(EdgeTy E)

Definition ModuleSummaryIndex.h:1023

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:1055

std::pair< ValueInfo, CalleeInfo > EdgeTy

<CalleeValueInfo, CalleeInfo> call edge pair.

Definition ModuleSummaryIndex.h:761

LLVM_ABI std::pair< unsigned, unsigned > specialRefCounts() const

SmallVector< EdgeTy, 0 > & mutableCalls()

Definition ModuleSummaryIndex.h:1021

ArrayRef< AllocInfo > allocs() const

Definition ModuleSummaryIndex.h:1113

ArrayRef< CallsiteInfo > callsites() const

Definition ModuleSummaryIndex.h:1096

void setNoUnwind()

Definition ModuleSummaryIndex.h:1013

void addTypeTest(GlobalValue::GUID Guid)

Add a type test to the summary.

Definition ModuleSummaryIndex.h:1088

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:1046

void setParamAccesses(std::vector< ParamAccess > NewParams)

Sets the list of known uses of pointer parameters.

Definition ModuleSummaryIndex.h:1077

unsigned instCount() const

Get the instruction count recorded for this function.

Definition ModuleSummaryIndex.h:1016

const TypeIdInfo * getTypeIdInfo() const

Definition ModuleSummaryIndex.h:1094

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:1063

ArrayRef< EdgeTy > calls() const

Return the list of <CalleeValueInfo, CalleeInfo> pairs.

Definition ModuleSummaryIndex.h:1019

ArrayRef< ParamAccess > paramAccesses() const

Returns the list of known uses of pointer parameters.

Definition ModuleSummaryIndex.h:1070

CallsitesTy & mutableCallsites()

Definition ModuleSummaryIndex.h:1102

ForceSummaryHotnessType

Types for -force-summary-edges-cold debugging option.

Definition ModuleSummaryIndex.h:764

@ FSHT_None

Definition ModuleSummaryIndex.h:765

@ FSHT_AllNonCritical

Definition ModuleSummaryIndex.h:766

@ FSHT_All

Definition ModuleSummaryIndex.h:767

FFlags fflags() const

Get function summary flags.

Definition ModuleSummaryIndex.h:1009

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:1028

static bool classof(const GlobalValueSummary *GVS)

Check if this is a function summary.

Definition ModuleSummaryIndex.h:1004

Function and variable summary information to aid decisions and implementation of importing.

Definition ModuleSummaryIndex.h:488

ImportKind

Definition ModuleSummaryIndex.h:493

@ Declaration

Definition ModuleSummaryIndex.h:502

@ Definition

Definition ModuleSummaryIndex.h:496

SummaryKind

Sububclass discriminator (for dyn_cast<> et al.)

Definition ModuleSummaryIndex.h:491

@ GlobalVarKind

Definition ModuleSummaryIndex.h:491

@ FunctionKind

Definition ModuleSummaryIndex.h:491

@ AliasKind

Definition ModuleSummaryIndex.h:491

bool isDSOLocal() const

Definition ModuleSummaryIndex.h:639

void setLive(bool Live)

Definition ModuleSummaryIndex.h:635

friend class ModuleSummaryIndex

Definition ModuleSummaryIndex.h:673

GVFlags flags() const

Get the flags for this GlobalValue (see struct GVFlags).

Definition ModuleSummaryIndex.h:617

void setDSOLocal(bool Local)

Definition ModuleSummaryIndex.h:637

StringRef modulePath() const

Get the path to the module containing this function.

Definition ModuleSummaryIndex.h:614

GlobalValueSummary * getBaseObject()

If this is an alias summary, returns the summary of the aliased object (a global variable or function...

Definition ModuleSummaryIndex.h:750

SummaryKind getSummaryKind() const

Which kind of summary subclass this is.

Definition ModuleSummaryIndex.h:607

GlobalValue::GUID getOriginalName() const

Returns the hash of the original name, it is identical to the GUID for externally visible symbols,...

Definition ModuleSummaryIndex.h:601

GlobalValue::VisibilityTypes getVisibility() const

Definition ModuleSummaryIndex.h:655

ArrayRef< ValueInfo > refs() const

Return the list of values referenced by this global value definition.

Definition ModuleSummaryIndex.h:666

bool shouldImportAsDecl() const

Definition ModuleSummaryIndex.h:645

void setLinkage(GlobalValue::LinkageTypes Linkage)

Sets the linkage to the value determined by global summary-based optimization.

Definition ModuleSummaryIndex.h:626

void setVisibility(GlobalValue::VisibilityTypes Vis)

Definition ModuleSummaryIndex.h:658

virtual ~GlobalValueSummary()=default

GlobalValueSummary::ImportKind importType() const

Definition ModuleSummaryIndex.h:651

void setModulePath(StringRef ModPath)

Set the path to the module containing this function, for use in the combined index.

Definition ModuleSummaryIndex.h:611

void setNotEligibleToImport()

Flag that this global value cannot be imported.

Definition ModuleSummaryIndex.h:663

void setCanAutoHide(bool CanAutoHide)

Definition ModuleSummaryIndex.h:641

GlobalValueSummary(SummaryKind K, GVFlags Flags, SmallVectorImpl< ValueInfo > &&Refs)

Definition ModuleSummaryIndex.h:589

bool isLive() const

Definition ModuleSummaryIndex.h:633

GlobalValue::LinkageTypes linkage() const

Return linkage type recorded for this global value.

Definition ModuleSummaryIndex.h:620

bool notEligibleToImport() const

Return true if this global value can't be imported.

Definition ModuleSummaryIndex.h:631

void setImportKind(ImportKind IK)

Definition ModuleSummaryIndex.h:649

void setOriginalName(GlobalValue::GUID Name)

Initialize the original name hash in this summary.

Definition ModuleSummaryIndex.h:604

bool canAutoHide() const

Definition ModuleSummaryIndex.h:643

static LLVM_ABI GUID getGUIDAssumingExternalLinkage(StringRef GlobalName)

Return a 64-bit global unique ID constructed from the name of a global symbol.

static bool isLocalLinkage(LinkageTypes Linkage)

uint64_t GUID

Declare a type to represent a global unique identifier for a global value.

static StringRef dropLLVMManglingEscape(StringRef Name)

If the given string begins with the GlobalValue name mangling escape character '\1',...

GUID getGUID() const

Return a 64-bit global unique ID constructed from global value name (i.e.

VisibilityTypes

An enumeration for the kinds of visibility of global values.

@ DefaultVisibility

The GV is visible.

LinkageTypes

An enumeration for the kinds of linkage for global values.

@ AvailableExternallyLinkage

Available for inspection, not emission.

Global variable summary information to aid decisions and implementation of importing.

Definition ModuleSummaryIndex.h:1182

void setWriteOnly(bool WO)

Definition ModuleSummaryIndex.h:1231

bool isConstant() const

Definition ModuleSummaryIndex.h:1234

bool maybeWriteOnly() const

Definition ModuleSummaryIndex.h:1233

void setVCallVisibility(GlobalObject::VCallVisibility Vis)

Definition ModuleSummaryIndex.h:1235

struct llvm::GlobalVarSummary::GVarFlags VarFlags

GVarFlags varflags() const

Definition ModuleSummaryIndex.h:1229

bool maybeReadOnly() const

Definition ModuleSummaryIndex.h:1232

void setReadOnly(bool RO)

Definition ModuleSummaryIndex.h:1230

ArrayRef< VirtFuncOffset > vTableFuncs() const

Definition ModuleSummaryIndex.h:1247

GlobalVarSummary(GVFlags Flags, GVarFlags VarFlags, SmallVectorImpl< ValueInfo > &&Refs)

Definition ModuleSummaryIndex.h:1219

GlobalObject::VCallVisibility getVCallVisibility() const

Definition ModuleSummaryIndex.h:1238

static bool classof(const GlobalValueSummary *GVS)

Check if this is a global variable summary.

Definition ModuleSummaryIndex.h:1225

void setVTableFuncs(VTableFuncList Funcs)

Definition ModuleSummaryIndex.h:1242

Class to hold module path string table and global value map, and encapsulate methods for operating on...

Definition ModuleSummaryIndex.h:1451

bool withAttributePropagation() const

Definition ModuleSummaryIndex.h:1691

bool withInternalizeAndPromote() const

Definition ModuleSummaryIndex.h:1699

TypeIdSummary & getOrInsertTypeIdSummary(StringRef TypeId)

Return an existing or new TypeIdSummary entry for TypeId.

Definition ModuleSummaryIndex.h:1937

std::optional< TypeIdCompatibleVtableInfo > getTypeIdCompatibleVtableSummary(StringRef TypeId) const

For the given TypeId, this returns the TypeIdCompatibleVtableMap entry if present in the summary map.

Definition ModuleSummaryIndex.h:1981

gvsummary_iterator end()

Definition ModuleSummaryIndex.h:1597

void addGlobalValueSummary(ValueInfo VI, std::unique_ptr< GlobalValueSummary > Summary)

Add a global value summary for the given ValueInfo.

Definition ModuleSummaryIndex.h:1804

ModulePathStringTableTy::value_type ModuleInfo

Definition ModuleSummaryIndex.h:1903

uint64_t getBlockCount() const

Definition ModuleSummaryIndex.h:1591

ValueInfo getOrInsertValueInfo(GlobalValue::GUID GUID)

Return a ValueInfo for GUID.

Definition ModuleSummaryIndex.h:1751

static constexpr uint64_t BitcodeSummaryVersion

Definition ModuleSummaryIndex.h:1579

bool withGlobalValueDeadStripping() const

Definition ModuleSummaryIndex.h:1684

static void discoverNodes(ValueInfo V, std::map< ValueInfo, bool > &FunctionHasParent)

Convenience function for doing a DFS on a ValueInfo.

Definition ModuleSummaryIndex.h:1628

StringRef saveString(StringRef String)

Definition ModuleSummaryIndex.h:1758

bool withWholeProgramVisibility() const

Definition ModuleSummaryIndex.h:1702

const TypeIdSummaryMapTy & typeIds() const

Definition ModuleSummaryIndex.h:1932

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:1898

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:1951

LLVM_ABI bool isGUIDLive(GlobalValue::GUID GUID) const

gvsummary_iterator begin()

Definition ModuleSummaryIndex.h:1595

const_gvsummary_iterator end() const

Definition ModuleSummaryIndex.h:1598

bool isReadOnly(const GlobalVarSummary *GVS) const

Definition ModuleSummaryIndex.h:1705

LLVM_ABI void setFlags(uint64_t Flags)

const_gvsummary_iterator begin() const

Definition ModuleSummaryIndex.h:1596

CfiFunctionIndex & cfiFunctionDecls()

Definition ModuleSummaryIndex.h:1785

bool isWriteOnly(const GlobalVarSummary *GVS) const

Definition ModuleSummaryIndex.h:1708

void addBlockCount(uint64_t C)

Definition ModuleSummaryIndex.h:1592

void setPartiallySplitLTOUnits()

Definition ModuleSummaryIndex.h:1729

const std::vector< uint64_t > & stackIds() const

Definition ModuleSummaryIndex.h:1601

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:1841

void releaseTemporaryMemory()

Definition ModuleSummaryIndex.h:1620

void setBlockCount(uint64_t C)

Definition ModuleSummaryIndex.h:1593

ValueInfo getValueInfo(const GlobalValueSummaryMapTy::value_type &R) const

Return a ValueInfo for the index value_type (convenient when iterating index).

Definition ModuleSummaryIndex.h:1740

const ModuleHash & getModuleHash(const StringRef ModPath) const

Get the module SHA1 hash recorded for the given module path.

Definition ModuleSummaryIndex.h:1873

static constexpr const char * getRegularLTOModuleName()

Definition ModuleSummaryIndex.h:1582

const CfiFunctionIndex & cfiFunctionDefs() const

Definition ModuleSummaryIndex.h:1783

void setEnableSplitLTOUnit()

Definition ModuleSummaryIndex.h:1723

void addGlobalValueSummary(StringRef ValueName, std::unique_ptr< GlobalValueSummary > Summary)

Add a global value summary for a value of the given name.

Definition ModuleSummaryIndex.h:1795

ModuleSummaryIndex(bool HaveGVs, bool EnableSplitLTOUnit=false, bool UnifiedLTO=false)

Definition ModuleSummaryIndex.h:1568

bool partiallySplitLTOUnits() const

Definition ModuleSummaryIndex.h:1728

LLVM_ABI void collectDefinedFunctionsForModule(StringRef ModulePath, GVSummaryMapTy &GVSummaryMap) const

Collect for the given module the list of functions it defines (GUID -> Summary).

const auto & typeIdCompatibleVtableMap() const

Definition ModuleSummaryIndex.h:1966

LLVM_ABI void dumpSCCs(raw_ostream &OS)

Print out strongly connected components for debugging.

bool isGlobalValueLive(const GlobalValueSummary *GVS) const

Definition ModuleSummaryIndex.h:1733

bool enableSplitLTOUnit() const

Definition ModuleSummaryIndex.h:1722

void setWithSupportsHotColdNew()

Definition ModuleSummaryIndex.h:1713

const ModuleInfo * getModule(StringRef ModPath) const

Return module entry for module with the given ModPath.

Definition ModuleSummaryIndex.h:1919

LLVM_ABI void propagateAttributes(const DenseSet< GlobalValue::GUID > &PreservedSymbols)

Do the access attribute and DSOLocal propagation in combined index.

bool haveGVs() const

Definition ModuleSummaryIndex.h:1586

void setSkipModuleByDistributedBackend()

Definition ModuleSummaryIndex.h:1718

void setWithAttributePropagation()

Definition ModuleSummaryIndex.h:1692

const StringMap< ModuleHash > & modulePaths() const

Table of modules, containing module hash and id.

Definition ModuleSummaryIndex.h:1865

bool withSupportsHotColdNew() const

Definition ModuleSummaryIndex.h:1712

LLVM_ABI void dump() const

Dump to stderr (for debugging).

ModuleInfo * addModule(StringRef ModPath, 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:1907

size_t size() const

Definition ModuleSummaryIndex.h:1599

void collectDefinedGVSummariesPerModule(Map &ModuleToDefinedGVSummaries) const

Collect for each module the list of Summaries it defines (GUID -> Summary).

Definition ModuleSummaryIndex.h:1998

void addGlobalValueSummary(const GlobalValue &GV, std::unique_ptr< GlobalValueSummary > Summary)

Add a global value summary for a value.

Definition ModuleSummaryIndex.h:1789

bool hasExportedFunctions(const Module &M) const

Check if the given Module has any functions available for exporting in the index.

Definition ModuleSummaryIndex.h:1928

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:1881

bool withDSOLocalPropagation() const

Definition ModuleSummaryIndex.h:1696

LLVM_ABI void exportToDot(raw_ostream &OS, const DenseSet< GlobalValue::GUID > &GUIDPreservedSymbols) const

Export summary to dot file for GraphViz.

bool hasUnifiedLTO() const

Definition ModuleSummaryIndex.h:1725

bool hasParamAccess() const

Definition ModuleSummaryIndex.h:1731

void setWithDSOLocalPropagation()

Definition ModuleSummaryIndex.h:1697

uint64_t getStackIdAtIndex(unsigned Index) const

Definition ModuleSummaryIndex.h:1610

StringMap< ModuleHash > & modulePaths()

Table of modules, containing hash and id.

Definition ModuleSummaryIndex.h:1870

void setWithInternalizeAndPromote()

Definition ModuleSummaryIndex.h:1700

LLVM_ABI void print(raw_ostream &OS, bool IsForDebug=false) const

Print to an output stream.

bool skipModuleByDistributedBackend() const

Definition ModuleSummaryIndex.h:1715

void setUnifiedLTO()

Definition ModuleSummaryIndex.h:1726

CfiFunctionIndex & cfiFunctionDefs()

Definition ModuleSummaryIndex.h:1782

ValueInfo getOrInsertValueInfo(const GlobalValue *GV)

Return a ValueInfo for GV and mark it as belonging to GV.

Definition ModuleSummaryIndex.h:1769

GlobalValueSummary * findSummaryInModule(ValueInfo VI, StringRef ModuleId) const

Find the summary for ValueInfo VI in module ModuleId, or nullptr if not found.

Definition ModuleSummaryIndex.h:1827

ValueInfo getValueInfo(GlobalValue::GUID GUID) const

Return a ValueInfo for GUID if it exists, otherwise return ValueInfo().

Definition ModuleSummaryIndex.h:1745

LLVM_ABI uint64_t getFlags() const

unsigned addOrGetStackIdIndex(uint64_t StackId)

Definition ModuleSummaryIndex.h:1603

GlobalValue::GUID getGUIDFromOriginalID(GlobalValue::GUID OriginalID) const

Return the GUID for OriginalId in the OidGuidMap.

Definition ModuleSummaryIndex.h:1777

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:1851

void setWithGlobalValueDeadStripping()

Definition ModuleSummaryIndex.h:1687

ModuleInfo * getModule(StringRef ModPath)

Return module entry for module with the given ModPath.

Definition ModuleSummaryIndex.h:1912

ValueInfo getOrInsertValueInfo(GlobalValue::GUID GUID, StringRef Name)

Return a ValueInfo for GUID setting value Name.

Definition ModuleSummaryIndex.h:1761

void setWithWholeProgramVisibility()

Definition ModuleSummaryIndex.h:1703

LLVM_ABI bool canImportGlobalVar(const GlobalValueSummary *S, bool AnalyzeRefs) const

Checks if we can import global variable from another module.

static std::string getGlobalNameForLocal(StringRef Name, StringRef Suffix)

Definition ModuleSummaryIndex.h:1887

void addOriginalName(GlobalValue::GUID ValueGUID, GlobalValue::GUID OrigGUID)

Add an original name for the value of the given GUID.

Definition ModuleSummaryIndex.h:1816

FunctionSummary calculateCallGraphRoot()

Definition ModuleSummaryIndex.h:1660

const CfiFunctionIndex & cfiFunctionDecls() const

Definition ModuleSummaryIndex.h:1786

TypeIdSummary * getTypeIdSummary(StringRef TypeId)

Definition ModuleSummaryIndex.h:1960

TypeIdCompatibleVtableInfo & getOrInsertTypeIdCompatibleVtableSummary(StringRef TypeId)

Return an existing or new TypeIdCompatibleVtableMap entry for TypeId.

Definition ModuleSummaryIndex.h:1974

A Module instance is used to store all the information related to an LLVM module.

PointerIntPair - This class implements a pair of a pointer and small integer.

Simple representation of a scaled number.

SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...

This class consists of common code factored out of the SmallVector class to reduce code duplication b...

void push_back(const T &Elt)

This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.

StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...

StringMapEntry< ModuleHash > value_type

bool insert(MapEntryTy *KeyValue)

insert - Insert the specified key/value pair into the map.

StringRef - Represent a constant reference to a string, i.e.

Saves strings in the provided stable storage and returns a StringRef with a stable character pointer.

Saves strings in the provided stable storage and returns a StringRef with a stable character pointer.

const IndexIterator & wrapped() const

iterator_adaptor_base()=default

A range adaptor for a pair of iterators.

This class implements an extremely fast bulk output stream that can only output to a stream.

A raw_ostream that writes to an std::string.

This provides a very simple, boring adaptor for a begin and end iterator into a range type.

#define llvm_unreachable(msg)

Marks that the current location is not supposed to be reachable.

@ Cold

Attempts to make code in the caller as efficient as possible under the assumption that the call is no...

@ C

The default llvm calling convention, compatible with C.

This is an optimization pass for GlobalISel generic memory operations.

bool operator<(int64_t V1, const APSInt &V2)

StringMapEntry< Value * > ValueName

std::vector< VirtFuncOffset > VTableFuncList

List of functions referenced by a particular vtable definition.

Definition ModuleSummaryIndex.h:1171

hash_code hash_value(const FixedPointSemantics &Val)

std::unordered_set< GlobalValueSummary * > GVSummaryPtrSet

A set of global value summary pointers.

Definition ModuleSummaryIndex.h:1419

std::vector< std::unique_ptr< GlobalValueSummary > > GlobalValueSummaryList

Definition ModuleSummaryIndex.h:140

InterleavedRange< Range > interleaved(const Range &R, StringRef Separator=", ", StringRef Prefix="", StringRef Suffix="")

Output range R as a sequence of interleaved elements.

const char * getHotnessName(CalleeInfo::HotnessType HT)

Definition ModuleSummaryIndex.h:122

decltype(auto) dyn_cast(const From &Val)

dyn_cast - Return the argument parameter cast to the specified type.

AllocationType

Definition ModuleSummaryIndex.h:397

@ All

Definition ModuleSummaryIndex.h:402

@ NotCold

Definition ModuleSummaryIndex.h:399

std::multimap< GlobalValue::GUID, std::pair< StringRef, TypeIdSummary > > TypeIdSummaryMapTy

Map of a type GUID to type id string and summary (multimap used in case of GUID conflicts).

Definition ModuleSummaryIndex.h:1423

std::array< uint32_t, 5 > ModuleHash

160 bits SHA1

Definition ModuleSummaryIndex.h:1399

bool operator!=(uint64_t V1, const APInt &V2)

DenseMap< GlobalValue::GUID, GlobalValueSummary * > GVSummaryMapTy

Map of global value GUID to its summary, used to identify values defined in a particular module,...

Definition ModuleSummaryIndex.h:1411

iterator_range< T > make_range(T x, T y)

Convenience function for iterating over sub-ranges.

void append_range(Container &C, Range &&R)

Wrapper function to append range R to container C.

std::string utostr(uint64_t X, bool isNeg=false)

bool operator==(const AddressRangeValuePair &LHS, const AddressRangeValuePair &RHS)

bool any_of(R &&range, UnaryPredicate P)

Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.

GlobalValueSummaryMapTy::iterator gvsummary_iterator

Definition ModuleSummaryIndex.h:1403

std::map< GlobalValue::GUID, GlobalValueSummaryInfo > GlobalValueSummaryMapTy

Map from global value GUID to corresponding summary structures.

Definition ModuleSummaryIndex.h:214

std::map< std::string, GVSummaryMapTy, std::less<> > ModuleToSummariesForIndexTy

Map of a module name to the GUIDs and summaries we will import from that module.

Definition ModuleSummaryIndex.h:1415

class LLVM_GSL_OWNER SmallVector

Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...

StringMap< ModuleHash > ModulePathStringTableTy

String table to hold/own module path strings, as well as a hash of the module.

Definition ModuleSummaryIndex.h:1407

bool isa(const From &Val)

isa - Return true if the parameter to the template is an instance of one of the template type argu...

@ First

Helpers to iterate all locations in the MemoryEffectsBase class.

raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)

OutputIt move(R &&Range, OutputIt Out)

Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.

decltype(auto) cast(const From &Val)

cast - Return the argument parameter cast to the specified type.

auto find_if(R &&Range, UnaryPredicate P)

Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.

std::vector< TypeIdOffsetVtableInfo > TypeIdCompatibleVtableInfo

List of vtable definitions decorated by a particular type identifier, and their corresponding offsets...

Definition ModuleSummaryIndex.h:1447

GlobalValueSummaryMapTy::const_iterator const_gvsummary_iterator

Type used for iterating through the global value summary map.

Definition ModuleSummaryIndex.h:1402

BumpPtrAllocatorImpl<> BumpPtrAllocator

The standard BumpPtrAllocator which just uses the default template parameters.

std::enable_if_t< std::is_unsigned_v< T >, T > SaturatingAdd(T X, T Y, bool *ResultOverflowed=nullptr)

Add two unsigned integers, X and Y, of type T.

Implement std::hash so that hash_code can be used in STL containers.

Summary of memprof metadata on allocations.

Definition ModuleSummaryIndex.h:427

AllocInfo(std::vector< MIBInfo > MIBs)

Definition ModuleSummaryIndex.h:449

AllocInfo(SmallVector< uint8_t > Versions, std::vector< MIBInfo > MIBs)

Definition ModuleSummaryIndex.h:452

std::vector< std::vector< ContextTotalSize > > ContextSizeInfos

Definition ModuleSummaryIndex.h:447

SmallVector< uint8_t > Versions

Definition ModuleSummaryIndex.h:436

std::vector< MIBInfo > MIBs

Definition ModuleSummaryIndex.h:439

Class to accumulate and hold information about a callee.

Definition ModuleSummaryIndex.h:62

HotnessType

Definition ModuleSummaryIndex.h:63

@ Cold

Definition ModuleSummaryIndex.h:65

@ Critical

Definition ModuleSummaryIndex.h:68

@ Hot

Definition ModuleSummaryIndex.h:67

@ None

Definition ModuleSummaryIndex.h:66

@ Unknown

Definition ModuleSummaryIndex.h:64

uint32_t HasTailCall

Definition ModuleSummaryIndex.h:77

static constexpr uint64_t MaxRelBlockFreq

Definition ModuleSummaryIndex.h:84

bool hasTailCall() const

Definition ModuleSummaryIndex.h:97

uint32_t RelBlockFreq

Definition ModuleSummaryIndex.h:82

void updateHotness(const HotnessType OtherHotness)

Definition ModuleSummaryIndex.h:93

uint32_t Hotness

Definition ModuleSummaryIndex.h:73

CalleeInfo(HotnessType Hotness, bool HasTC, uint64_t RelBF)

Definition ModuleSummaryIndex.h:89

HotnessType getHotness() const

Definition ModuleSummaryIndex.h:101

static constexpr int32_t ScaleShift

Definition ModuleSummaryIndex.h:83

void setHasTailCall(const bool HasTC)

Definition ModuleSummaryIndex.h:99

void updateRelBlockFreq(uint64_t BlockFreq, uint64_t EntryFreq)

Update RelBlockFreq from BlockFreq and EntryFreq.

Definition ModuleSummaryIndex.h:108

CalleeInfo()

Definition ModuleSummaryIndex.h:86

static constexpr unsigned RelBlockFreqBits

The value stored in RelBlockFreq has to be interpreted as the digits of a scaled number with a scale ...

Definition ModuleSummaryIndex.h:81

Summary of memprof callsite metadata.

Definition ModuleSummaryIndex.h:357

SmallVector< unsigned > StackIdIndices

Definition ModuleSummaryIndex.h:375

SmallVector< unsigned > Clones

Definition ModuleSummaryIndex.h:369

ValueInfo Callee

Definition ModuleSummaryIndex.h:359

CallsiteInfo(ValueInfo Callee, SmallVector< unsigned > StackIdIndices)

Definition ModuleSummaryIndex.h:377

CallsiteInfo(ValueInfo Callee, SmallVector< unsigned > Clones, SmallVector< unsigned > StackIdIndices)

Definition ModuleSummaryIndex.h:379

Definition ModuleSummaryIndex.h:351

uint64_t FullStackId

Definition ModuleSummaryIndex.h:352

uint64_t TotalSize

Definition ModuleSummaryIndex.h:353

static FunctionSummary::ConstVCall getEmptyKey()

Definition ModuleSummaryIndex.h:1142

static FunctionSummary::ConstVCall getTombstoneKey()

Definition ModuleSummaryIndex.h:1146

static unsigned getHashValue(FunctionSummary::ConstVCall I)

Definition ModuleSummaryIndex.h:1156

static bool isEqual(FunctionSummary::ConstVCall L, FunctionSummary::ConstVCall R)

Definition ModuleSummaryIndex.h:1150

static FunctionSummary::VFuncId getEmptyKey()

Definition ModuleSummaryIndex.h:1128

static bool isEqual(FunctionSummary::VFuncId L, FunctionSummary::VFuncId R)

Definition ModuleSummaryIndex.h:1134

static FunctionSummary::VFuncId getTombstoneKey()

Definition ModuleSummaryIndex.h:1130

static unsigned getHashValue(FunctionSummary::VFuncId I)

Definition ModuleSummaryIndex.h:1138

static bool isEqual(ValueInfo L, ValueInfo R)

Definition ModuleSummaryIndex.h:339

static ValueInfo getEmptyKey()

Definition ModuleSummaryIndex.h:327

static ValueInfo getTombstoneKey()

Definition ModuleSummaryIndex.h:331

static bool isSpecialKey(ValueInfo V)

Definition ModuleSummaryIndex.h:335

static unsigned getHashValue(ValueInfo I)

Definition ModuleSummaryIndex.h:345

An information struct used to provide DenseMap with the various necessary components for a given valu...

A specification for a virtual function call with all constant integer arguments.

Definition ModuleSummaryIndex.h:782

std::vector< uint64_t > Args

Definition ModuleSummaryIndex.h:784

VFuncId VFunc

Definition ModuleSummaryIndex.h:783

Flags specific to function summaries.

Definition ModuleSummaryIndex.h:808

bool anyFlagSet()

Definition ModuleSummaryIndex.h:850

unsigned NoRecurse

Definition ModuleSummaryIndex.h:813

unsigned NoInline

Definition ModuleSummaryIndex.h:817

unsigned MayThrow

Definition ModuleSummaryIndex.h:824

FFlags & operator&=(const FFlags &RHS)

Definition ModuleSummaryIndex.h:836

unsigned AlwaysInline

Definition ModuleSummaryIndex.h:819

unsigned ReadNone

Definition ModuleSummaryIndex.h:811

unsigned NoUnwind

Definition ModuleSummaryIndex.h:822

unsigned ReturnDoesNotAlias

Definition ModuleSummaryIndex.h:814

unsigned HasUnknownCall

Definition ModuleSummaryIndex.h:827

unsigned ReadOnly

Definition ModuleSummaryIndex.h:812

unsigned MustBeUnreachable

Definition ModuleSummaryIndex.h:834

ConstantRange Offsets

Definition ModuleSummaryIndex.h:886

ValueInfo Callee

Definition ModuleSummaryIndex.h:885

uint64_t ParamNo

Definition ModuleSummaryIndex.h:884

Call(uint64_t ParamNo, ValueInfo Callee, const ConstantRange &Offsets)

Definition ModuleSummaryIndex.h:889

ParamAccess(uint64_t ParamNo, const ConstantRange &Use)

Definition ModuleSummaryIndex.h:906

uint64_t ParamNo

Definition ModuleSummaryIndex.h:893

static constexpr uint32_t RangeWidth

Definition ModuleSummaryIndex.h:878

std::vector< Call > Calls

In the per-module summary, it summarizes the byte offset applied to each pointer parameter before pas...

Definition ModuleSummaryIndex.h:903

ConstantRange Use

The range contains byte offsets from the parameter pointer which accessed by the function.

Definition ModuleSummaryIndex.h:898

All type identifier related information.

Definition ModuleSummaryIndex.h:789

std::vector< ConstVCall > TypeCheckedLoadConstVCalls

Definition ModuleSummaryIndex.h:804

std::vector< VFuncId > TypeCheckedLoadVCalls

Definition ModuleSummaryIndex.h:798

std::vector< ConstVCall > TypeTestAssumeConstVCalls

List of virtual calls made by this function using (respectively) llvm.assume(llvm....

Definition ModuleSummaryIndex.h:803

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:793

std::vector< VFuncId > TypeTestAssumeVCalls

List of virtual calls made by this function using (respectively) llvm.assume(llvm....

Definition ModuleSummaryIndex.h:798

An "identifier" for a virtual function.

Definition ModuleSummaryIndex.h:774

GlobalValue::GUID GUID

Definition ModuleSummaryIndex.h:775

uint64_t Offset

Definition ModuleSummaryIndex.h:776

void addSummary(std::unique_ptr< GlobalValueSummary > Summary)

Add a summary corresponding to a global value definition in a module with the corresponding GUID.

Definition ModuleSummaryIndex.h:679

void verifyLocal() const

Verify that the HasLocal flag is consistent with the SummaryList.

Definition ModuleSummaryIndex.h:686

ArrayRef< std::unique_ptr< GlobalValueSummary > > getSummaryList() const

Access a read-only list of global value summary structures for a particular value held in the GlobalV...

Definition ModuleSummaryIndex.h:169

bool hasLocal() const

Definition ModuleSummaryIndex.h:181

GlobalValueSummaryInfo(bool HaveGVs)

Definition ModuleSummaryIndex.h:676

union llvm::GlobalValueSummaryInfo::NameOrGV U

Group flags (Linkage, NotEligibleToImport, etc.) as a bitfield.

Definition ModuleSummaryIndex.h:506

GVFlags(GlobalValue::LinkageTypes Linkage, GlobalValue::VisibilityTypes Visibility, bool NotEligibleToImport, bool Live, bool IsLocal, bool CanAutoHide, ImportKind ImportType)

Convenience Constructors.

Definition ModuleSummaryIndex.h:550

unsigned DSOLocal

Indicates that the linker resolved the symbol to a definition from within the same linkage unit.

Definition ModuleSummaryIndex.h:532

unsigned CanAutoHide

In the per-module summary, indicates that the global value is linkonce_odr and global unnamed addr (s...

Definition ModuleSummaryIndex.h:543

unsigned ImportType

This field is written by the ThinLTO indexing step to postlink combined summary.

Definition ModuleSummaryIndex.h:547

unsigned NotEligibleToImport

Indicate if the global value cannot be imported (e.g.

Definition ModuleSummaryIndex.h:521

unsigned Linkage

The linkage type of the associated global value.

Definition ModuleSummaryIndex.h:514

unsigned Visibility

Indicates the visibility.

Definition ModuleSummaryIndex.h:517

unsigned Live

In per-module summary, indicate that the global value must be considered a live root for index-based ...

Definition ModuleSummaryIndex.h:528

unsigned VCallVisibility

Definition ModuleSummaryIndex.h:1216

GVarFlags(bool ReadOnly, bool WriteOnly, bool Constant, GlobalObject::VCallVisibility Vis)

Definition ModuleSummaryIndex.h:1190

unsigned MaybeReadOnly

Definition ModuleSummaryIndex.h:1200

unsigned MaybeWriteOnly

Definition ModuleSummaryIndex.h:1204

unsigned Constant

Definition ModuleSummaryIndex.h:1213

static NodeRef getEntryNode(ModuleSummaryIndex *I)

Definition ModuleSummaryIndex.h:2095

static NodeRef valueInfoFromEdge(FunctionSummary::EdgeTy &P)

Definition ModuleSummaryIndex.h:2040

ValueInfo NodeRef

Definition ModuleSummaryIndex.h:2037

static ChildIteratorType child_begin(NodeRef N)

Definition ModuleSummaryIndex.h:2052

static ChildEdgeIteratorType child_edge_begin(NodeRef N)

Definition ModuleSummaryIndex.h:2072

static NodeRef edge_dest(EdgeRef E)

Definition ModuleSummaryIndex.h:2090

SmallVector< FunctionSummary::EdgeTy, 0 >::iterator ChildEdgeIteratorType

Definition ModuleSummaryIndex.h:2047

mapped_iterator< SmallVector< FunctionSummary::EdgeTy, 0 >::iterator, decltype(&valueInfoFromEdge)> ChildIteratorType

Definition ModuleSummaryIndex.h:2043

static NodeRef getEntryNode(ValueInfo V)

Definition ModuleSummaryIndex.h:2050

static ChildIteratorType child_end(NodeRef N)

Definition ModuleSummaryIndex.h:2062

static ChildEdgeIteratorType child_edge_end(NodeRef N)

Definition ModuleSummaryIndex.h:2081

FunctionSummary::EdgeTy & EdgeRef

Definition ModuleSummaryIndex.h:2038

typename ModuleSummaryIndex *::UnknownGraphTypeError NodeRef

Summary of a single MIB in a memprof metadata on allocations.

Definition ModuleSummaryIndex.h:406

MIBInfo(AllocationType AllocType, SmallVector< unsigned > StackIdIndices)

Definition ModuleSummaryIndex.h:416

AllocationType AllocType

Definition ModuleSummaryIndex.h:408

SmallVector< unsigned > StackIdIndices

Definition ModuleSummaryIndex.h:414

ValueInfo VTableVI

Definition ModuleSummaryIndex.h:1441

TypeIdOffsetVtableInfo(uint64_t Offset, ValueInfo VI)

Definition ModuleSummaryIndex.h:1437

uint64_t AddressPointOffset

Definition ModuleSummaryIndex.h:1440

std::map< uint64_t, WholeProgramDevirtResolution > WPDRes

Mapping from byte offset to whole-program devirt resolution for that (typeid, byte offset) pair.

Definition ModuleSummaryIndex.h:1327

TypeTestResolution TTRes

Definition ModuleSummaryIndex.h:1323

Kind

Specifies which kind of type check we should emit for this byte array.

Definition ModuleSummaryIndex.h:1259

@ Unknown

Unknown (analysis not performed, don't lower)

Definition ModuleSummaryIndex.h:1266

@ Single

Single element (last example in "Short Inline Bit Vectors")

Definition ModuleSummaryIndex.h:1263

@ Inline

Inlined bit vector ("Short Inline Bit Vectors")

Definition ModuleSummaryIndex.h:1262

@ Unsat

Unsatisfiable type (i.e. no global has this type metadata)

Definition ModuleSummaryIndex.h:1260

@ AllOnes

All-ones bit vector ("Eliminating Bit Vector Checks for All-Ones Bit Vectors")

Definition ModuleSummaryIndex.h:1264

@ ByteArray

Test a byte array (first example)

Definition ModuleSummaryIndex.h:1261

unsigned SizeM1BitWidth

Range of size-1 expressed as a bit width.

Definition ModuleSummaryIndex.h:1272

uint64_t SizeM1

Definition ModuleSummaryIndex.h:1280

enum llvm::TypeTestResolution::Kind TheKind

uint8_t BitMask

Definition ModuleSummaryIndex.h:1281

uint64_t AlignLog2

Definition ModuleSummaryIndex.h:1279

uint64_t InlineBits

Definition ModuleSummaryIndex.h:1282

Struct that holds a reference to a particular GUID in a global value summary.

Definition ModuleSummaryIndex.h:219

bool hasLocal() const

Definition ModuleSummaryIndex.h:244

void setReadOnly()

Definition ModuleSummaryIndex.h:273

void setWriteOnly()

Definition ModuleSummaryIndex.h:279

PointerIntPair< const GlobalValueSummaryMapTy::value_type *, 3, int > RefAndFlags

Definition ModuleSummaryIndex.h:222

LLVM_ABI GlobalValue::VisibilityTypes getELFVisibility() const

Returns the most constraining visibility among summaries.

bool isValidAccessSpecifier() const

Definition ModuleSummaryIndex.h:269

const GlobalValueSummaryMapTy::value_type * getRef() const

Definition ModuleSummaryIndex.h:284

ArrayRef< std::unique_ptr< GlobalValueSummary > > getSummaryList() const

Definition ModuleSummaryIndex.h:238

StringRef name() const

Definition ModuleSummaryIndex.h:250

bool isWriteOnly() const

Definition ModuleSummaryIndex.h:261

const GlobalValue * getValue() const

Definition ModuleSummaryIndex.h:233

void verifyLocal() const

Definition ModuleSummaryIndex.h:242

bool hasName() const

Definition ModuleSummaryIndex.h:248

Flags

Definition ModuleSummaryIndex.h:220

@ WriteOnly

Definition ModuleSummaryIndex.h:220

@ ReadOnly

Definition ModuleSummaryIndex.h:220

@ HaveGV

Definition ModuleSummaryIndex.h:220

ValueInfo(bool HaveGVs, const GlobalValueSummaryMapTy::value_type *R)

Definition ModuleSummaryIndex.h:225

bool isReadOnly() const

Definition ModuleSummaryIndex.h:257

LLVM_ABI bool canAutoHide() const

Checks if all copies are eligible for auto-hiding (have flag set).

unsigned getAccessSpecifier() const

Definition ModuleSummaryIndex.h:265

LLVM_ABI bool isDSOLocal(bool WithDSOLocalPropagation=false) const

Checks if all summaries are DSO local (have the flag set).

GlobalValue::GUID getGUID() const

Definition ModuleSummaryIndex.h:232

bool haveGVs() const

Definition ModuleSummaryIndex.h:256

uint64_t VTableOffset

Definition ModuleSummaryIndex.h:1168

VirtFuncOffset(ValueInfo VI, uint64_t Offset)

Definition ModuleSummaryIndex.h:1164

ValueInfo FuncVI

Definition ModuleSummaryIndex.h:1167

Kind

Definition ModuleSummaryIndex.h:1297

@ UniformRetVal

Uniform return value optimization.

Definition ModuleSummaryIndex.h:1299

@ VirtualConstProp

Virtual constant propagation.

Definition ModuleSummaryIndex.h:1301

@ UniqueRetVal

Unique return value optimization.

Definition ModuleSummaryIndex.h:1300

@ Indir

Just do a regular virtual call.

Definition ModuleSummaryIndex.h:1298

uint32_t Bit

Definition ModuleSummaryIndex.h:1314

uint64_t Info

Additional information for the resolution:

Definition ModuleSummaryIndex.h:1308

uint32_t Byte

Definition ModuleSummaryIndex.h:1313

enum llvm::WholeProgramDevirtResolution::Kind TheKind

std::map< std::vector< uint64_t >, ByArg > ResByArg

Resolutions for calls with all constant integer arguments (excluding the first argument,...

Definition ModuleSummaryIndex.h:1319

std::string SingleImplName

Definition ModuleSummaryIndex.h:1294

Kind

Definition ModuleSummaryIndex.h:1286

@ SingleImpl

Single implementation devirtualization.

Definition ModuleSummaryIndex.h:1288

@ Indir

Just do a regular virtual call.

Definition ModuleSummaryIndex.h:1287

@ BranchFunnel

When retpoline mitigation is enabled, use a branch funnel that is defined in the merged module.

Definition ModuleSummaryIndex.h:1289

This class should be specialized by any type that needs to be converted to/from a YAML mapping.

const GlobalValue * GV

The GlobalValue corresponding to this summary.

Definition ModuleSummaryIndex.h:155

StringRef Name

Summary string representation.

Definition ModuleSummaryIndex.h:162

NameOrGV(bool HaveGVs)

Definition ModuleSummaryIndex.h:144