LLVM: lib/Passes/PassBuilderPipelines.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

148

149using namespace llvm;

150

152 "enable-ml-inliner", cl::init(InliningAdvisorMode::Default), cl::Hidden,

153 cl::desc("Enable ML policy for inliner. Currently trained for -Oz only"),

155 "Heuristics-based inliner version"),

156 clEnumValN(InliningAdvisorMode::Development, "development",

157 "Use development mode (runtime-loadable model)"),

158 clEnumValN(InliningAdvisorMode::Release, "release",

159 "Use release mode (AOT-compiled model)")));

160

161

165 cl::desc("Enable inline deferral during PGO"));

166

169 cl::desc("Enable module inliner"));

170

173 cl::desc("Perform mandatory inlinings module-wide, before performing "

174 "inlining"));

175

178 cl::desc("Eagerly invalidate more analyses in default pipelines"));

179

182 cl::desc("Enable function merging as part of the optimization pipeline"));

183

186 cl::desc("Run the loop rotation transformation after PGO instrumentation"));

187

190 cl::desc("Enable inter-procedural analyses"));

191

194 cl::desc("Run Partial inlining pass"));

195

198 cl::desc("Run cleanup optimization passes after vectorization"));

199

201 cl::desc("Run the NewGVN pass"));

202

205 cl::desc("Enable the experimental LoopInterchange Pass"));

206

209 cl::desc("Enable Unroll And Jam Pass"));

210

213 cl::desc("Enable the LoopFlatten Pass"));

214

215

216

217

218

219

222 cl::desc("Enable loop header duplication at any optimization level"));

223

226 cl::desc("Enable DFA jump threading"),

228

231 cl::desc("Enable hot-cold splitting pass"));

232

235 cl::desc("Enable ir outliner pass"));

236

239 cl::desc("Disable pre-instrumentation inliner"));

240

243 cl::desc("Control the amount of inlining in pre-instrumentation inliner "

244 "(default = 75)"));

245

248 cl::desc("Enable the GVN hoisting pass (default = off)"));

249

252 cl::desc("Enable the GVN sinking pass (default = off)"));

253

255 "enable-jump-table-to-switch",

256 cl::desc("Enable JumpTableToSwitch pass (default = off)"));

257

258

259

262 cl::desc("Enable control height reduction optimization (CHR)"));

263

266 cl::desc("Indicate the sample profile being used is flattened, i.e., "

267 "no inline hierarchy exists in the profile"));

268

271 cl::desc("Enable order file instrumentation (default = off)"));

272

275 cl::desc("Enable lowering of the matrix intrinsics"));

276

280 "Enable pass to eliminate conditions based on linear constraints"));

281

283 "attributor-enable", cl::Hidden, cl::init(AttributorRunOption::NONE),

284 cl::desc("Enable the attributor inter-procedural deduction pass"),

286 "enable all attributor runs"),

287 clEnumValN(AttributorRunOption::MODULE, "module",

288 "enable module-wide attributor runs"),

289 clEnumValN(AttributorRunOption::CGSCC, "cgscc",

290 "enable call graph SCC attributor runs"),

291 clEnumValN(AttributorRunOption::NONE, "none",

292 "disable attributor runs")));

293

296 cl::desc("Enable profile instrumentation sampling (default = off)"));

299 cl::desc("Enable the experimental Loop Versioning LICM pass"));

300

302 "instrument-cold-function-only-path", cl::init(""),

303 cl::desc("File path for cold function only instrumentation(requires use "

304 "with --pgo-instrument-cold-function-only)"),

306

309

310namespace llvm {

312}

313

327}

328

329namespace llvm {

331}

332

335 for (auto &C : PeepholeEPCallbacks)

336 C(FPM, Level);

337}

340 for (auto &C : LateLoopOptimizationsEPCallbacks)

341 C(LPM, Level);

342}

345 for (auto &C : LoopOptimizerEndEPCallbacks)

346 C(LPM, Level);

347}

350 for (auto &C : ScalarOptimizerLateEPCallbacks)

351 C(FPM, Level);

352}

355 for (auto &C : CGSCCOptimizerLateEPCallbacks)

356 C(CGPM, Level);

357}

360 for (auto &C : VectorizerStartEPCallbacks)

361 C(FPM, Level);

362}

366 for (auto &C : OptimizerEarlyEPCallbacks)

367 C(MPM, Level, Phase);

368}

372 for (auto &C : OptimizerLastEPCallbacks)

373 C(MPM, Level, Phase);

374}

377 for (auto &C : FullLinkTimeOptimizationEarlyEPCallbacks)

378 C(MPM, Level);

379}

382 for (auto &C : FullLinkTimeOptimizationLastEPCallbacks)

383 C(MPM, Level);

384}

387 for (auto &C : PipelineStartEPCallbacks)

388 C(MPM, Level);

389}

392 for (auto &C : PipelineEarlySimplificationEPCallbacks)

393 C(MPM, Level, Phase);

394}

395

396

399}

400

401

405}

406

407

409PassBuilder::buildO1FunctionSimplificationPipeline(OptimizationLevel Level,

411

413

416

417

418

420

421

423

424

428

430

432

435

436

437

438

440

441

442

443

444

445

446

447

448

449

451

452

453

454

457

458

459

460

461

462

463

465 false));

466

469

471 true));

475

478

480

482

485

486

487

488

489

490

496

498

500 true,

501 true));

505

506

508 false,

509 false));

510

511

513

514

516

517

518

519

521

522

523

524

526

527

528

531

533

535

536

537

538

544

545 return FPM;

546}

547

552

553

554

555 if (Level.getSpeedupLevel() == 1)

556 return buildO1FunctionSimplificationPipeline(Level, Phase);

557

559

562

563

564

566

567

571

572

575

576

581 }

582

583

585

586

589

590

593

598

599 if (!Level.isOptimizingForSize())

601

603

604

605

607 !Level.isOptimizingForSize())

609

613

614

615

616

618

621

622

623

624

625

626

627

628

629

630

632

633

634

635

638

639

640

641

642

643

644

646 false));

647

648

652

654 true));

659

662

663 {

667 LPM2.addPass(std::move(ExtraPasses));

668 }

669

671

673

676

677

678

679

680

681

687

689

691 true,

692 true));

696

697

698

700 false,

701 false));

702

703

705

706

707

709

710

714 else

716

717

718

719

721

722

723

724

726

727

728

731

732

733

736

739

740

741

742

744

745

747

750

753 true),

754 true, false));

755

757

759

761 .convertSwitchRangeToICmp(true)

762 .hoistCommonInsts(true)

763 .sinkCommonInsts(true)));

766

767 return FPM;

768}

769

770void PassBuilder::addRequiredLTOPreLinkPasses(ModulePassManager &MPM) {

773}

774

780 return;

782

784

785

786

787

788

791 IP, true,

794

799 true)));

802

805

806 MPM.addPass(std::move(MIWP));

807

808

809

810

812}

813

817

822 false,

823 false),

825 }

826}

827

830 bool IsCS, bool AtomicCounterUpdate,

831 std::string ProfileFile,

832 std::string ProfileRemappingFile,

835

836 if (!RunProfileGen) {

837 assert(!ProfileFile.empty() && "Profile use expecting a profile file!");

840

841

843 return;

844 }

845

846

849

850 addPostPGOLoopRotation(MPM, Level);

851

853 if (!ProfileFile.empty())

854 Options.InstrProfileOutput = ProfileFile;

855

856 Options.DoCounterPromotion = true;

857 Options.UseBFIInPromotion = IsCS;

860

861

862 Options.DoCounterPromotion = false;

863 }

864 Options.Atomic = AtomicCounterUpdate;

866}

867

870 bool AtomicCounterUpdate, std::string ProfileFile,

872 if (!RunProfileGen) {

873 assert(!ProfileFile.empty() && "Profile use expecting a profile file!");

876

877

879 return;

880 }

881

882

885

887 if (!ProfileFile.empty())

888 Options.InstrProfileOutput = ProfileFile;

889

890 Options.DoCounterPromotion = false;

891 Options.UseBFIInPromotion = IsCS;

892 Options.Atomic = AtomicCounterUpdate;

894}

895

897 return getInlineParams(Level.getSpeedupLevel(), Level.getSizeLevel());

898}

899

906 else

908

909

910

911

912

913

917

918 if (PGOOpt)

920

924

925

926

929

930

931 MIWP.addModulePass(

933 }

934

935

936

938

939

940

941

942

944

945

946

947

948

949

952

953

954

955

956

958

959

960

963

964

965

968

970

971

972

976

977

978

980

981

982

983

986

990 }

991

992

995

996 return MIWP;

997}

998

1003

1005

1006

1007

1008

1009

1010

1014

1015 if (PGOOpt)

1017

1018

1019

1020

1021

1022

1023

1025

1031 }

1032

1036

1042 }

1043

1044 return MPM;

1045}

1046

1051 "Should not be used for O0 pipeline");

1052

1054 "FullLTOPostLink shouldn't call buildModuleSimplificationPipeline!");

1055

1057

1058

1059

1060 if (PGOOpt && PGOOpt->PseudoProbeForProfiling &&

1063

1065

1066

1067

1068

1069 bool LoadSampleProfile =

1070 HasSampleProfile &&

1072

1073

1074

1075

1076

1077

1078

1079

1080

1081

1082

1083

1084

1085

1086

1089

1090

1091

1092

1094

1095

1098

1101

1102

1103

1112 }

1113

1114 if (LoadSampleProfile) {

1115

1116

1118 PGOOpt->ProfileRemappingFile, Phase));

1119

1120

1122

1123

1125

1126

1127

1128

1131 }

1132

1133

1134

1136

1139

1140

1141

1142

1146

1148

1149

1150

1151

1152

1158

1159

1160

1162

1163

1165

1166

1167

1169

1173 GlobalCleanupPM.addPass(

1177

1178

1180 const bool IsPGOPreLink = PGOOpt && IsPreLink;

1181 const bool IsPGOInstrGen =

1183 const bool IsPGOInstrUse =

1185 const bool IsMemprofUse = IsPGOPreLink && !PGOOpt->MemoryProfile.empty();

1186

1187

1189 "Enabling both instrumented PGO and contextual instrumentation is not "

1190 "supported.");

1191

1192 const bool IsCtxProfGen = !IsPGOInstrGen && IsPreLink &&

1194 const bool IsCtxProfUse =

1196

1199 "--instrument-cold-function-only-path is provided but "

1200 "--pgo-instrument-cold-function-only is not enabled");

1202 IsPGOPreLink &&

1204

1205 if (IsPGOInstrGen || IsPGOInstrUse || IsMemprofUse || IsCtxProfGen ||

1206 IsCtxProfUse || IsColdFuncOnlyInstrGen)

1207 addPreInlinerPasses(MPM, Level, Phase);

1208

1209

1210 if (IsPGOInstrGen || IsPGOInstrUse) {

1211 addPGOInstrPasses(MPM, Level,

1212 IsPGOInstrGen,

1213 false, PGOOpt->AtomicCounterUpdate,

1214 PGOOpt->ProfileFile, PGOOpt->ProfileRemappingFile,

1215 PGOOpt->FS);

1216 } else if (IsCtxProfGen || IsCtxProfUse) {

1218

1219

1220

1221

1222

1224 if (IsCtxProfUse)

1225 return MPM;

1226 addPostPGOLoopRotation(MPM, Level);

1228 } else if (IsColdFuncOnlyInstrGen) {

1229 addPGOInstrPasses(

1230 MPM, Level, true, false,

1233 }

1234

1235 if (IsPGOInstrGen || IsPGOInstrUse || IsCtxProfGen)

1237

1241

1242 if (IsMemprofUse)

1244

1248

1250

1253 else

1255

1256

1257

1259

1262

1263

1266

1267 return MPM;

1268}

1269

1270

1275

1277 if (IsFullLTO) {

1278

1279

1280

1281

1282

1283

1284

1285

1290 Level.getSpeedupLevel(), !PTO.LoopUnrolling,

1293

1294

1295

1296

1297

1298

1300 }

1301

1302 if (!IsFullLTO) {

1303

1304

1306 }

1307

1309

1312

1313

1314

1315

1316

1317

1323 true));

1328 true));

1332 FPM.addPass(std::move(ExtraPasses));

1333 }

1334

1335

1336

1337

1338

1339

1340

1341

1342

1343

1345 .forwardSwitchCondToPhi(true)

1346 .convertSwitchRangeToICmp(true)

1347 .convertSwitchToLookupTable(true)

1348 .needCanonicalLoops(false)

1349 .hoistCommonInsts(true)

1350 .sinkCommonInsts(true)));

1351

1352 if (IsFullLTO) {

1356 }

1357

1358

1363 }

1364 }

1365

1367

1368 if (!IsFullLTO) {

1370

1371

1372

1373

1374

1375

1376

1380 }

1382 Level.getSpeedupLevel(), !PTO.LoopUnrolling,

1385

1386

1387

1388

1389

1390

1392 }

1393

1396

1397

1398

1399

1400

1401

1402

1405 true),

1406 true, false));

1407

1408

1409

1411}

1412

1416 const bool LTOPreLink = isLTOPreLink(LTOPhase);

1418

1419

1420

1423

1424

1425

1426

1427

1428

1429

1430

1431

1432

1433 if (!LTOPreLink)

1435

1438

1439

1440

1441

1443

1444

1445

1446

1447

1448 if (!LTOPreLink && PGOOpt) {

1450 addPGOInstrPasses(MPM, Level, true,

1451 true, PGOOpt->AtomicCounterUpdate,

1452 PGOOpt->CSProfileGenFile, PGOOpt->ProfileRemappingFile,

1453 PGOOpt->FS);

1455 addPGOInstrPasses(MPM, Level, false,

1456 true, PGOOpt->AtomicCounterUpdate,

1457 PGOOpt->ProfileFile, PGOOpt->ProfileRemappingFile,

1458 PGOOpt->FS);

1459 }

1460

1461

1462

1463

1464

1465

1466

1467

1470

1472

1474

1475

1476

1477

1478

1482

1485 true),

1486 true, false));

1487 }

1488

1491

1495 }

1496

1497

1498

1501

1502

1503

1504

1505

1506

1507

1508

1510

1512

1513

1516 LTOPreLink));

1517

1518

1519

1520

1523 std::move(LPM), false, false));

1524

1525

1526

1527

1528

1530

1531

1532

1534

1535 addVectorPasses(Level, OptimizePM, false);

1536

1537

1538

1539

1540

1542

1543

1545

1546

1547

1548

1550

1551

1553

1554

1555

1558 .convertSwitchRangeToICmp(true)

1559 .speculateUnpredictables(true)

1560 .hoistLoadsStoresWithCondFaulting(true)));

1561

1562

1565

1567

1568

1569

1570

1573

1574

1575

1576

1577

1580

1581

1582

1583

1584

1587

1588

1589

1592

1596

1597

1598

1599

1600 if (!LTOPreLink)

1602

1603 return MPM;

1604}

1605

1611

1613

1614

1616

1617

1619

1620 if (PGOOpt && PGOOpt->DebugInfoForProfiling)

1622

1623

1625

1626

1628

1629

1631

1632 if (PGOOpt && PGOOpt->PseudoProbeForProfiling &&

1635

1636

1638

1640 addRequiredLTOPreLinkPasses(MPM);

1641 return MPM;

1642}

1643

1646 bool EmitSummary) {

1648 if (ThinLTO)

1650 else

1653

1654

1655

1656

1657

1660

1661

1664 else {

1665

1668

1670 }

1671 return MPM;

1672}

1673

1678

1680

1681

1683

1684

1686

1687 if (PGOOpt && PGOOpt->DebugInfoForProfiling)

1689

1690

1692

1693

1694

1695

1698

1699

1700

1702 addRequiredLTOPreLinkPasses(MPM);

1703 return MPM;

1704 }

1705

1706

1707

1708

1709

1710

1711

1712

1715

1716 if (PGOOpt && PGOOpt->PseudoProbeForProfiling &&

1719

1720

1721

1722

1727

1728

1730

1731 addRequiredLTOPreLinkPasses(MPM);

1732

1733 return MPM;

1734}

1735

1739

1740 if (ImportSummary) {

1741

1742

1746

1747

1748

1749

1750

1751

1752

1753

1754

1755

1756

1757

1758

1759

1760

1761

1764 }

1765

1767

1768

1771

1772

1773

1776 return MPM;

1777 }

1781 } else {

1782

1785 }

1786

1789

1790

1792

1793 return MPM;

1794}

1795

1798

1801}

1802

1807

1809

1810

1811

1813

1815

1816

1819

1820

1823

1825

1826

1828

1829 return MPM;

1830 }

1831

1833

1835 PGOOpt->ProfileRemappingFile,

1837

1838

1840 }

1841

1842

1844

1845

1846

1848

1849

1850

1852

1853 if (Level.getSpeedupLevel() > 1) {

1856

1857

1858

1859

1860

1863

1864

1865

1872

1873

1874

1875

1879

1880

1881

1883 }

1884

1885

1886

1887

1889

1890

1892

1893

1894

1896

1897

1899

1900

1902

1903

1904

1907

1909

1910

1912

1913 return MPM;

1914 }

1915

1916

1918

1919

1921

1922

1923

1925

1926

1928

1929

1930

1931

1932

1935 if (Level.getSpeedupLevel() > 1)

1938

1941

1942

1944

1945

1946

1947

1948

1949

1954 } else {

1957 true,

1960 }

1961

1962

1963

1964

1967 nullptr,

1969

1970

1972

1973

1975

1976

1978

1979

1980

1982

1984

1987

1990

1992

1993

1994

1995 if (PGOOpt) {

1997 addPGOInstrPasses(MPM, Level, true,

1998 true, PGOOpt->AtomicCounterUpdate,

1999 PGOOpt->CSProfileGenFile, PGOOpt->ProfileRemappingFile,

2000 PGOOpt->FS);

2002 addPGOInstrPasses(MPM, Level, false,

2003 true, PGOOpt->AtomicCounterUpdate,

2004 PGOOpt->ProfileFile, PGOOpt->ProfileRemappingFile,

2005 PGOOpt->FS);

2006 }

2007

2008

2010

2011

2012

2014

2015

2018

2021

2022

2023

2026

2027

2030 }

2031

2035 true),

2036 true, false));

2037

2040 else

2042

2043

2045

2046

2050

2056

2057

2058

2062

2063

2065 std::move(LPM), false, true));

2066

2068

2069 addVectorPasses(Level, MainFPM, true);

2070

2071

2074

2079

2080

2081

2082

2083

2085

2086

2089

2090

2093

2094

2096

2097

2098

2099

2100

2102

2103

2104

2105

2107

2108

2110 .convertSwitchRangeToICmp(true)

2111 .hoistCommonInsts(true)

2112 .speculateUnpredictables(true)));

2114

2115

2117

2118

2120

2123

2126

2128

2129

2131

2132 return MPM;

2133}

2134

2139 "buildO0DefaultPipeline should only be used with O0");

2140

2142

2143

2144

2145

2146

2147 if (PGOOpt && PGOOpt->PseudoProbeForProfiling)

2149

2153 MPM,

2155 false, PGOOpt->AtomicCounterUpdate, PGOOpt->ProfileFile,

2156 PGOOpt->ProfileRemappingFile, PGOOpt->FS);

2157

2158

2161

2163

2164 if (PGOOpt && PGOOpt->DebugInfoForProfiling)

2166

2168

2169

2171 PGOOpt->ProfileRemappingFile,

2173 true,

2174 true));

2175

2176

2178 }

2179

2181

2182

2183

2184

2185

2187 false));

2188

2191

2195

2196 if (!CGSCCOptimizerLateEPCallbacks.empty()) {

2201 }

2202 if (!LateLoopOptimizationsEPCallbacks.empty()) {

2208 }

2209 }

2210 if (!LoopOptimizerEndEPCallbacks.empty()) {

2216 }

2217 }

2218 if (!ScalarOptimizerLateEPCallbacks.empty()) {

2223 }

2224

2226

2227 if (!VectorizerStartEPCallbacks.empty()) {

2232 }

2233

2242

2244

2246 addRequiredLTOPreLinkPasses(MPM);

2247

2249

2250 return MPM;

2251}

2252

2255

2256

2257

2258

2259

2260

2261

2263

2264

2265

2268

2269

2270

2271

2272

2275

2276

2277 if (TM)

2279

2280 return AA;

2281}

aarch64 falkor hwpf fix Falkor HW Prefetch Fix Late Phase

AggressiveInstCombiner - Combine expression patterns to form expressions with fewer,...

Provides passes to inlining "always_inline" functions.

This is the interface for LLVM's primary stateless and local alias analysis.

This file provides the interface for LLVM's Call Graph Profile pass.

This header provides classes for managing passes over SCCs of the call graph.

#define clEnumValN(ENUMVAL, FLAGNAME, DESC)

cl::opt< std::string > UseCtxProfile("use-ctx-profile", cl::init(""), cl::Hidden, cl::desc("Use the specified contextual profile file"))

This file provides the interface for a simple, fast CSE pass.

This file provides a pass which clones the current module and runs the provided pass pipeline on the ...

Super simple passes to force specific function attrs from the commandline into the IR for debugging p...

Provides passes for computing function attributes based on interprocedural analyses.

This file provides the interface for LLVM's Global Value Numbering pass which eliminates fully redund...

This is the interface for a simple mod/ref and alias analysis over globals.

AcceleratorCodeSelection - Identify all functions reachable from a kernel, removing those that are un...

This header defines various interfaces for pass management in LLVM.

Interfaces for passes which infer implicit function attributes from the name and signature of functio...

This file provides the primary interface to the instcombine pass.

Defines passes for running instruction simplification across chunks of IR.

This file provides the interface for LLVM's PGO Instrumentation lowering pass.

See the comments on JumpThreadingPass.

This header defines the LoopLoadEliminationPass object.

This header provides classes for managing a pipeline of passes over loops in LLVM IR.

The header file for the LowerConstantIntrinsics pass as used by the new pass manager.

The header file for the LowerExpectIntrinsic pass as used by the new pass manager.

This pass performs merges of loads and stores on both sides of a.

This file provides the interface for LLVM's Global Value Numbering pass.

This header enumerates the LLVM-provided high-level optimization levels.

This file provides the interface for IR based instrumentation passes ( (profile-gen,...

Define option tunables for PGO.

static cl::opt< bool > EnableMergeFunctions("enable-merge-functions", cl::init(false), cl::Hidden, cl::desc("Enable function merging as part of the optimization pipeline"))

static cl::opt< bool > EnableGlobalAnalyses("enable-global-analyses", cl::init(true), cl::Hidden, cl::desc("Enable inter-procedural analyses"))

static cl::opt< bool > EnableIROutliner("ir-outliner", cl::init(false), cl::Hidden, cl::desc("Enable ir outliner pass"))

static cl::opt< bool > RunNewGVN("enable-newgvn", cl::init(false), cl::Hidden, cl::desc("Run the NewGVN pass"))

static cl::opt< bool > DisablePreInliner("disable-preinline", cl::init(false), cl::Hidden, cl::desc("Disable pre-instrumentation inliner"))

static cl::opt< bool > EnableEagerlyInvalidateAnalyses("eagerly-invalidate-analyses", cl::init(true), cl::Hidden, cl::desc("Eagerly invalidate more analyses in default pipelines"))

static cl::opt< bool > ExtraVectorizerPasses("extra-vectorizer-passes", cl::init(false), cl::Hidden, cl::desc("Run cleanup optimization passes after vectorization"))

static void addAnnotationRemarksPass(ModulePassManager &MPM)

static cl::opt< bool > EnablePostPGOLoopRotation("enable-post-pgo-loop-rotation", cl::init(true), cl::Hidden, cl::desc("Run the loop rotation transformation after PGO instrumentation"))

static InlineParams getInlineParamsFromOptLevel(OptimizationLevel Level)

static cl::opt< bool > EnableGVNSink("enable-gvn-sink", cl::desc("Enable the GVN sinking pass (default = off)"))

static cl::opt< bool > PerformMandatoryInliningsFirst("mandatory-inlining-first", cl::init(false), cl::Hidden, cl::desc("Perform mandatory inlinings module-wide, before performing " "inlining"))

static cl::opt< bool > EnableGVNHoist("enable-gvn-hoist", cl::desc("Enable the GVN hoisting pass (default = off)"))

static cl::opt< bool > RunPartialInlining("enable-partial-inlining", cl::init(false), cl::Hidden, cl::desc("Run Partial inlining pass"))

cl::opt< std::string > UseCtxProfile

static cl::opt< bool > EnableDFAJumpThreading("enable-dfa-jump-thread", cl::desc("Enable DFA jump threading"), cl::init(false), cl::Hidden)

static cl::opt< bool > EnableCHR("enable-chr", cl::init(true), cl::Hidden, cl::desc("Enable control height reduction optimization (CHR)"))

static cl::opt< bool > EnableHotColdSplit("hot-cold-split", cl::desc("Enable hot-cold splitting pass"))

static cl::opt< bool > EnableLoopInterchange("enable-loopinterchange", cl::init(false), cl::Hidden, cl::desc("Enable the experimental LoopInterchange Pass"))

static cl::opt< bool > EnableSampledInstr("enable-sampled-instrumentation", cl::init(false), cl::Hidden, cl::desc("Enable profile instrumentation sampling (default = off)"))

static cl::opt< int > PreInlineThreshold("preinline-threshold", cl::Hidden, cl::init(75), cl::desc("Control the amount of inlining in pre-instrumentation inliner " "(default = 75)"))

static cl::opt< bool > FlattenedProfileUsed("flattened-profile-used", cl::init(false), cl::Hidden, cl::desc("Indicate the sample profile being used is flattened, i.e., " "no inline hierarchy exists in the profile"))

static cl::opt< bool > EnableLoopHeaderDuplication("enable-loop-header-duplication", cl::init(false), cl::Hidden, cl::desc("Enable loop header duplication at any optimization level"))

static cl::opt< bool > EnableUnrollAndJam("enable-unroll-and-jam", cl::init(false), cl::Hidden, cl::desc("Enable Unroll And Jam Pass"))

static cl::opt< std::string > InstrumentColdFuncOnlyPath("instrument-cold-function-only-path", cl::init(""), cl::desc("File path for cold function only instrumentation(requires use " "with --pgo-instrument-cold-function-only)"), cl::Hidden)

cl::opt< bool > PGOInstrumentColdFunctionOnly

static cl::opt< bool > EnableModuleInliner("enable-module-inliner", cl::init(false), cl::Hidden, cl::desc("Enable module inliner"))

static cl::opt< bool > EnableMatrix("enable-matrix", cl::init(false), cl::Hidden, cl::desc("Enable lowering of the matrix intrinsics"))

static cl::opt< AttributorRunOption > AttributorRun("attributor-enable", cl::Hidden, cl::init(AttributorRunOption::NONE), cl::desc("Enable the attributor inter-procedural deduction pass"), cl::values(clEnumValN(AttributorRunOption::ALL, "all", "enable all attributor runs"), clEnumValN(AttributorRunOption::MODULE, "module", "enable module-wide attributor runs"), clEnumValN(AttributorRunOption::CGSCC, "cgscc", "enable call graph SCC attributor runs"), clEnumValN(AttributorRunOption::NONE, "none", "disable attributor runs")))

static cl::opt< bool > EnableOrderFileInstrumentation("enable-order-file-instrumentation", cl::init(false), cl::Hidden, cl::desc("Enable order file instrumentation (default = off)"))

static cl::opt< bool > UseLoopVersioningLICM("enable-loop-versioning-licm", cl::init(false), cl::Hidden, cl::desc("Enable the experimental Loop Versioning LICM pass"))

static bool isLTOPreLink(ThinOrFullLTOPhase Phase)

static cl::opt< bool > EnablePGOInlineDeferral("enable-npm-pgo-inline-deferral", cl::init(true), cl::Hidden, cl::desc("Enable inline deferral during PGO"))

Flag to enable inline deferral during PGO.

static cl::opt< bool > EnableJumpTableToSwitch("enable-jump-table-to-switch", cl::desc("Enable JumpTableToSwitch pass (default = off)"))

static cl::opt< InliningAdvisorMode > UseInlineAdvisor("enable-ml-inliner", cl::init(InliningAdvisorMode::Default), cl::Hidden, cl::desc("Enable ML policy for inliner. Currently trained for -Oz only"), cl::values(clEnumValN(InliningAdvisorMode::Default, "default", "Heuristics-based inliner version"), clEnumValN(InliningAdvisorMode::Development, "development", "Use development mode (runtime-loadable model)"), clEnumValN(InliningAdvisorMode::Release, "release", "Use release mode (AOT-compiled model)")))

static cl::opt< bool > EnableConstraintElimination("enable-constraint-elimination", cl::init(true), cl::Hidden, cl::desc("Enable pass to eliminate conditions based on linear constraints"))

static cl::opt< bool > EnableLoopFlatten("enable-loop-flatten", cl::init(false), cl::Hidden, cl::desc("Enable the LoopFlatten Pass"))

This file implements relative lookup table converter that converts lookup tables to relative lookup t...

assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())

This file provides the interface for LLVM's Scalar Replacement of Aggregates pass.

This file provides the interface for the pseudo probe implementation for AutoFDO.

This file provides the interface for the sampled PGO loader pass.

This is the interface for a metadata-based scoped no-alias analysis.

This file provides the interface for the pass responsible for both simplifying and canonicalizing the...

This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...

This is the interface for a metadata-based TBAA.

Defines the virtual file system interface vfs::FileSystem.

A manager for alias analyses.

void registerFunctionAnalysis()

Register a specific AA result.

void registerModuleAnalysis()

Register a specific AA result.

Inlines functions marked as "always_inline".

Assign a GUID to functions as metadata.

Analysis pass providing a never-invalidated alias analysis result.

Simple pass that canonicalizes aliases.

A pass that merges duplicate global constants into a single constant.

This class implements a trivial dead store elimination.

Eliminate dead arguments (and return values) from functions.

A pass that transforms external global definitions into declarations.

Pass embeds a copy of the module optimized with the provided pass pipeline into a global variable.

The core GVN pass object.

Pass to remove unused function declarations.

Optimize globals that never have their address taken.

Pass to perform split of global variables.

Analysis pass providing a never-invalidated alias analysis result.

Pass to outline cold regions.

Pass to perform interprocedural constant propagation.

Pass to outline similar regions.

Run instruction simplification across each instruction in the function.

The instrumentation pass for recording function order.

Instrumentation based profiling lowering pass.

A smart pointer to a reference-counted object that inherits from RefCountedBase or ThreadSafeRefCount...

This pass performs 'jump threading', which looks at blocks that have multiple predecessors and multip...

Performs Loop Invariant Code Motion Pass.

Loop unroll pass that only does full loop unrolling and peeling.

Performs Loop Idiom Recognize Pass.

Performs Loop Inst Simplify Pass.

A simple loop rotation transformation.

Performs basic CFG simplifications to assist other loop passes.

A pass that does profile-guided sinking of instructions into loops.

A simple loop rotation transformation.

Loop unroll pass that will support both full and partial unrolling.

Merge identical functions.

The module inliner pass for the new pass manager.

Module pass, wrapping the inliner pass.

void addModulePass(T Pass)

Add a module pass that runs before the CGSCC passes.

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

Simple pass that provides a name to every anonymous globals.

OpenMP optimizations pass.

static const OptimizationLevel O3

Optimize for fast execution as much as possible.

static const OptimizationLevel Oz

A very specialized mode that will optimize for code size at any and all costs.

static const OptimizationLevel O0

Disable as many optimizations as possible.

static const OptimizationLevel Os

Similar to O2 but tries to optimize for small code size instead of fast execution without triggering ...

static const OptimizationLevel O2

Optimize for fast execution as much as possible without triggering significant incremental compile ti...

static const OptimizationLevel O1

Optimize quickly without destroying debuggability.

static bool isCtxIRPGOInstrEnabled()

The instrumentation (profile-instr-gen) pass for IR based PGO.

The instrumentation (profile-instr-gen) pass for IR based PGO.

The profile annotation (profile-instr-use) pass for IR based PGO.

The profile size based optimization pass for memory intrinsics.

Pass to remove unused function declarations.

void invokeFullLinkTimeOptimizationLastEPCallbacks(ModulePassManager &MPM, OptimizationLevel Level)

ModuleInlinerWrapperPass buildInlinerPipeline(OptimizationLevel Level, ThinOrFullLTOPhase Phase)

Construct the module pipeline that performs inlining as well as the inlining-driven cleanups.

void invokeOptimizerEarlyEPCallbacks(ModulePassManager &MPM, OptimizationLevel Level, ThinOrFullLTOPhase Phase)

void invokeVectorizerStartEPCallbacks(FunctionPassManager &FPM, OptimizationLevel Level)

AAManager buildDefaultAAPipeline()

Build the default AAManager with the default alias analysis pipeline registered.

void invokeCGSCCOptimizerLateEPCallbacks(CGSCCPassManager &CGPM, OptimizationLevel Level)

ModulePassManager buildThinLTOPreLinkDefaultPipeline(OptimizationLevel Level)

Build a pre-link, ThinLTO-targeting default optimization pipeline to a pass manager.

void invokeScalarOptimizerLateEPCallbacks(FunctionPassManager &FPM, OptimizationLevel Level)

ModulePassManager buildPerModuleDefaultPipeline(OptimizationLevel Level, ThinOrFullLTOPhase Phase=ThinOrFullLTOPhase::None)

Build a per-module default optimization pipeline.

void invokePipelineStartEPCallbacks(ModulePassManager &MPM, OptimizationLevel Level)

ModulePassManager buildO0DefaultPipeline(OptimizationLevel Level, ThinOrFullLTOPhase Phase=ThinOrFullLTOPhase::None)

Build an O0 pipeline with the minimal semantically required passes.

FunctionPassManager buildFunctionSimplificationPipeline(OptimizationLevel Level, ThinOrFullLTOPhase Phase)

Construct the core LLVM function canonicalization and simplification pipeline.

void invokePeepholeEPCallbacks(FunctionPassManager &FPM, OptimizationLevel Level)

void invokePipelineEarlySimplificationEPCallbacks(ModulePassManager &MPM, OptimizationLevel Level, ThinOrFullLTOPhase Phase)

void invokeLoopOptimizerEndEPCallbacks(LoopPassManager &LPM, OptimizationLevel Level)

ModulePassManager buildLTODefaultPipeline(OptimizationLevel Level, ModuleSummaryIndex *ExportSummary)

Build an LTO default optimization pipeline to a pass manager.

ModulePassManager buildModuleInlinerPipeline(OptimizationLevel Level, ThinOrFullLTOPhase Phase)

Construct the module pipeline that performs inlining with module inliner pass.

ModulePassManager buildThinLTODefaultPipeline(OptimizationLevel Level, const ModuleSummaryIndex *ImportSummary)

Build a ThinLTO default optimization pipeline to a pass manager.

void invokeLateLoopOptimizationsEPCallbacks(LoopPassManager &LPM, OptimizationLevel Level)

void invokeFullLinkTimeOptimizationEarlyEPCallbacks(ModulePassManager &MPM, OptimizationLevel Level)

ModulePassManager buildFatLTODefaultPipeline(OptimizationLevel Level, bool ThinLTO, bool EmitSummary)

Build a fat object default optimization pipeline.

ModulePassManager buildModuleSimplificationPipeline(OptimizationLevel Level, ThinOrFullLTOPhase Phase)

Construct the core LLVM module canonicalization and simplification pipeline.

ModulePassManager buildModuleOptimizationPipeline(OptimizationLevel Level, ThinOrFullLTOPhase LTOPhase)

Construct the core LLVM module optimization pipeline.

void addPGOInstrPassesForO0(ModulePassManager &MPM, bool RunProfileGen, bool IsCS, bool AtomicCounterUpdate, std::string ProfileFile, std::string ProfileRemappingFile, IntrusiveRefCntPtr< vfs::FileSystem > FS)

Add PGOInstrumenation passes for O0 only.

void invokeOptimizerLastEPCallbacks(ModulePassManager &MPM, OptimizationLevel Level, ThinOrFullLTOPhase Phase)

ModulePassManager buildLTOPreLinkDefaultPipeline(OptimizationLevel Level)

Build a pre-link, LTO-targeting default optimization pipeline to a pass manager.

LLVM_ATTRIBUTE_MINSIZE std::enable_if_t< is_detected< HasRunOnLoopT, PassT >::value > addPass(PassT &&Pass)

LLVM_ATTRIBUTE_MINSIZE std::enable_if_t<!std::is_same_v< PassT, PassManager > > addPass(PassT &&Pass)

bool isEmpty() const

Returns if the pass manager contains any passes.

unsigned LicmMssaNoAccForPromotionCap

Tuning option to disable promotion to scalars in LICM with MemorySSA, if the number of access is too ...

bool SLPVectorization

Tuning option to enable/disable slp loop vectorization, set based on opt level.

int InlinerThreshold

Tuning option to override the default inliner threshold.

bool EagerlyInvalidateAnalyses

bool CallGraphProfile

Tuning option to enable/disable call graph profile.

bool MergeFunctions

Tuning option to enable/disable function merging.

bool ForgetAllSCEVInLoopUnroll

Tuning option to forget all SCEV loops in LoopUnroll.

unsigned LicmMssaOptCap

Tuning option to cap the number of calls to retrive clobbering accesses in MemorySSA,...

bool LoopInterleaving

Tuning option to set loop interleaving on/off, set based on opt level.

PipelineTuningOptions()

Constructor sets pipeline tuning defaults based on cl::opts.

bool LoopUnrolling

Tuning option to enable/disable loop unrolling. Its default value is true.

bool LoopVectorization

Tuning option to enable/disable loop vectorization, set based on opt level.

Reassociate commutative expressions.

A pass to do RPO deduction and propagation of function attributes.

This pass performs function-level constant propagation and merging.

The sample profiler data loader pass.

Analysis pass providing a never-invalidated alias analysis result.

This pass transforms loops that contain branches or switches on loop- invariant conditions to have mu...

A pass to simplify and canonicalize the CFG of a function.

virtual void registerDefaultAliasAnalyses(AAManager &)

Allow the target to register alias analyses with the AAManager for use with the new pass manager.

Analysis pass providing a never-invalidated alias analysis result.

Optimize scalar/vector interactions in IR using target cost models.

Interfaces for registering analysis passes, producing common pass manager configurations,...

@ C

The default llvm calling convention, compatible with C.

ValuesClass values(OptsTy... Options)

Helper to build a ValuesClass by forwarding a variable number of arguments as an initializer list to ...

initializer< Ty > init(const Ty &Val)

@ Assume

Do not drop type tests (default).

@ All

Drop only llvm.assumes using type test value.

This is an optimization pass for GlobalISel generic memory operations.

cl::opt< bool > EnableKnowledgeRetention

ModuleToFunctionPassAdaptor createModuleToFunctionPassAdaptor(FunctionPassT &&Pass, bool EagerlyInvalidate=false)

A function to deduce a function pass type and wrap it in the templated adaptor.

ThinOrFullLTOPhase

This enumerates the LLVM full LTO or ThinLTO optimization phases.

@ FullLTOPreLink

Full LTO prelink phase.

@ ThinLTOPostLink

ThinLTO postlink (backend compile) phase.

@ None

No LTO/ThinLTO behavior needed.

@ FullLTOPostLink

Full LTO postlink (backend compile) phase.

@ ThinLTOPreLink

ThinLTO prelink (summary) phase.

ModuleToPostOrderCGSCCPassAdaptor createModuleToPostOrderCGSCCPassAdaptor(CGSCCPassT &&Pass)

A function to deduce a function pass type and wrap it in the templated adaptor.

CGSCCToFunctionPassAdaptor createCGSCCToFunctionPassAdaptor(FunctionPassT &&Pass, bool EagerlyInvalidate=false, bool NoRerun=false)

A function to deduce a function pass type and wrap it in the templated adaptor.

cl::opt< bool > ForgetSCEVInLoopUnroll

bool AreStatisticsEnabled()

Check if statistics are enabled.

cl::opt< bool > EnableMemProfContextDisambiguation

Enable MemProf context disambiguation for thin link.

InlineParams getInlineParams()

Generate the parameters to tune the inline cost analysis based only on the commandline options.

cl::opt< unsigned > SetLicmMssaNoAccForPromotionCap

std::enable_if_t< is_detected< HasRunOnLoopT, LoopPassT >::value, FunctionToLoopPassAdaptor > createFunctionToLoopPassAdaptor(LoopPassT &&Pass, bool UseMemorySSA=false, bool UseBlockFrequencyInfo=false, bool UseBranchProbabilityInfo=false)

A function to deduce a loop pass type and wrap it in the templated adaptor.

cl::opt< unsigned > MaxDevirtIterations("max-devirt-iterations", cl::ReallyHidden, cl::init(4))

cl::opt< unsigned > SetLicmMssaOptCap

A DCE pass that assumes instructions are dead until proven otherwise.

This pass attempts to minimize the number of assume without loosing any information.

Hoist/decompose integer division and remainder instructions to enable CFG improvements and better cod...

A simple and fast domtree-based CSE pass.

Pass which forces specific function attributes into the IR, primarily as a debugging tool.

A simple and fast domtree-based GVN pass to hoist common expressions from sibling branches.

Uses an "inverted" value numbering to decide the similarity of expressions and sinks similar expressi...

A set of parameters to control various transforms performed by IPSCCP pass.

A pass which infers function attributes from the names and signatures of function declarations in a m...

Provides context on when an inline advisor is constructed in the pipeline (e.g., link phase,...

Thresholds to tune inline cost analysis.

std::optional< int > HotCallSiteThreshold

Threshold to use when the callsite is considered hot.

int DefaultThreshold

The default threshold to start with for a callee.

std::optional< bool > EnableDeferral

Indicate whether we should allow inline deferral.

std::optional< int > HintThreshold

Threshold to use for callees with inline hint.

Options for the frontend instrumentation based profiling pass.

A no-op pass template which simply forces a specific analysis result to be invalidated.

Pass to forward loads in a loop around the backedge to subsequent iterations.

A set of parameters used to control various transforms performed by the LoopUnroll pass.

Computes function attributes in post-order over the call graph.

A utility pass template to force an analysis result to be available.