2018-03-28 19:44:36 +02:00
|
|
|
//===- llvm/Transforms/Utils.h - Utility Transformations --------*- C++ -*-===//
|
|
|
|
//
|
2019-01-19 09:50:56 +01:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2018-03-28 19:44:36 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This header file defines prototypes for accessor functions that expose passes
|
|
|
|
// in the Utils transformations library.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_TRANSFORMS_UTILS_H
|
|
|
|
#define LLVM_TRANSFORMS_UTILS_H
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
class ModulePass;
|
|
|
|
class FunctionPass;
|
|
|
|
class Pass;
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// createMetaRenamerPass - Rename everything with metasyntatic names.
|
|
|
|
//
|
|
|
|
ModulePass *createMetaRenamerPass();
|
|
|
|
|
2020-04-20 23:41:30 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// createUniqueInternalLinkageNamesPass - Make internal linkage symbol names
|
|
|
|
// unique.
|
|
|
|
//
|
|
|
|
ModulePass *createUniqueInternalLinkageNamesPass();
|
|
|
|
|
2018-03-28 19:44:36 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// LowerInvoke - This pass removes invoke instructions, converting them to call
|
|
|
|
// instructions.
|
|
|
|
//
|
|
|
|
FunctionPass *createLowerInvokePass();
|
|
|
|
extern char &LowerInvokePassID;
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// InstructionNamer - Give any unnamed non-void instructions "tmp" names.
|
|
|
|
//
|
|
|
|
FunctionPass *createInstructionNamerPass();
|
|
|
|
extern char &InstructionNamerID;
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// LowerSwitch - This pass converts SwitchInst instructions into a sequence of
|
|
|
|
// chained binary branch instructions.
|
|
|
|
//
|
|
|
|
FunctionPass *createLowerSwitchPass();
|
|
|
|
extern char &LowerSwitchID;
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// EntryExitInstrumenter pass - Instrument function entry/exit with calls to
|
|
|
|
// mcount(), @__cyg_profile_func_{enter,exit} and the like. There are two
|
|
|
|
// variants, intended to run pre- and post-inlining, respectively.
|
|
|
|
//
|
|
|
|
FunctionPass *createEntryExitInstrumenterPass();
|
|
|
|
FunctionPass *createPostInlineEntryExitInstrumenterPass();
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// BreakCriticalEdges - Break all of the critical edges in the CFG by inserting
|
|
|
|
// a dummy basic block. This pass may be "required" by passes that cannot deal
|
|
|
|
// with critical edges. For this usage, a pass must call:
|
|
|
|
//
|
|
|
|
// AU.addRequiredID(BreakCriticalEdgesID);
|
|
|
|
//
|
|
|
|
// This pass obviously invalidates the CFG, but can update forward dominator
|
|
|
|
// (set, immediate dominators, tree, and frontier) information.
|
|
|
|
//
|
|
|
|
FunctionPass *createBreakCriticalEdgesPass();
|
|
|
|
extern char &BreakCriticalEdgesID;
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// LCSSA - This pass inserts phi nodes at loop boundaries to simplify other loop
|
|
|
|
// optimizations.
|
|
|
|
//
|
|
|
|
Pass *createLCSSAPass();
|
|
|
|
extern char &LCSSAID;
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// AddDiscriminators - Add DWARF path discriminators to the IR.
|
|
|
|
FunctionPass *createAddDiscriminatorsPass();
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// PromoteMemoryToRegister - This pass is used to promote memory references to
|
|
|
|
// be register references. A simple example of the transformation performed by
|
|
|
|
// this pass is:
|
|
|
|
//
|
|
|
|
// FROM CODE TO CODE
|
|
|
|
// %X = alloca i32, i32 1 ret i32 42
|
|
|
|
// store i32 42, i32 *%X
|
|
|
|
// %Y = load i32* %X
|
|
|
|
// ret i32 %Y
|
|
|
|
//
|
|
|
|
FunctionPass *createPromoteMemoryToRegisterPass();
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// LoopSimplify - Insert Pre-header blocks into the CFG for every function in
|
|
|
|
// the module. This pass updates dominator information, loop information, and
|
|
|
|
// does not add critical edges to the CFG.
|
|
|
|
//
|
|
|
|
// AU.addRequiredID(LoopSimplifyID);
|
|
|
|
//
|
|
|
|
Pass *createLoopSimplifyPass();
|
|
|
|
extern char &LoopSimplifyID;
|
|
|
|
|
2018-03-30 00:42:08 +02:00
|
|
|
/// This function returns a new pass that downgrades the debug info in the
|
|
|
|
/// module to line tables only.
|
|
|
|
ModulePass *createStripNonLineTableDebugInfoPass();
|
2018-09-04 19:19:13 +02:00
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// ControlHeightReudction - Merges conditional blocks of code and reduces the
|
|
|
|
// number of conditional branches in the hot paths based on profiles.
|
|
|
|
//
|
|
|
|
FunctionPass *createControlHeightReductionLegacyPass();
|
2019-11-11 20:42:18 +01:00
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// InjectTLIMappingsLegacy - populates the VFABI attribute with the
|
|
|
|
// scalar-to-vector mappings from the TargetLibraryInfo.
|
|
|
|
//
|
|
|
|
FunctionPass *createInjectTLIMappingsLegacyPass();
|
2020-03-28 12:13:35 +01:00
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// UnifyLoopExits - For each loop, creates a new block N such that all exiting
|
|
|
|
// blocks branch to N, and then N distributes control flow to all the original
|
|
|
|
// exit blocks.
|
|
|
|
//
|
|
|
|
FunctionPass *createUnifyLoopExitsPass();
|
2020-04-15 11:35:51 +02:00
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// FixIrreducible - Convert each SCC with irreducible control-flow
|
|
|
|
// into a natural loop.
|
|
|
|
//
|
|
|
|
FunctionPass *createFixIrreduciblePass();
|
2020-05-07 13:41:20 +02:00
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// AssumeSimplify - remove redundant assumes and merge assumes in the same
|
|
|
|
// BasicBlock when possible.
|
|
|
|
//
|
|
|
|
FunctionPass *createAssumeSimplifyPass();
|
Add CanonicalizeFreezeInLoops pass
Summary:
If an induction variable is frozen and used, SCEV yields imprecise result
because it doesn't say anything about frozen variables.
Due to this reason, performance degradation happened after
https://reviews.llvm.org/D76483 is merged, causing
SCEV yield imprecise result and preventing LSR to optimize a loop.
The suggested solution here is to add a pass which canonicalizes frozen variables
inside a loop. To be specific, it pushes freezes out of the loop by freezing
the initial value and step values instead & dropping nsw/nuw flags from instructions used by freeze.
This solution was also mentioned at https://reviews.llvm.org/D70623 .
Reviewers: spatel, efriedma, lebedev.ri, fhahn, jdoerfert
Reviewed By: fhahn
Subscribers: nikic, mgorny, hiraditya, javed.absar, llvm-commits, sanwou01, nlopes
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D77523
2020-05-07 22:28:42 +02:00
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// CanonicalizeFreezeInLoops - Canonicalize freeze instructions in loops so they
|
|
|
|
// don't block SCEV.
|
|
|
|
//
|
|
|
|
Pass *createCanonicalizeFreezeInLoopsPass();
|
2020-05-07 13:41:20 +02:00
|
|
|
} // namespace llvm
|
2018-03-28 19:44:36 +02:00
|
|
|
|
|
|
|
#endif
|