LLVM 20.0.0git
Macros | Functions | Variables
SimplifyCFGPass.cpp File Reference
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/CFG.h"
#include "llvm/Analysis/DomTreeUpdater.h"
#include "llvm/Analysis/GlobalsModRef.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/CFG.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/ValueHandle.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/Scalar/SimplifyCFG.h"
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Transforms/Utils/SimplifyCFGOptions.h"
#include <utility>

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "simplifycfg"
 

Functions

 STATISTIC (NumSimpl, "Number of blocks simplified")
 
static bool performBlockTailMerging (Function &F, ArrayRef< BasicBlock * > BBs, std::vector< DominatorTree::UpdateType > *Updates)
 
static bool tailMergeBlocksWithSimilarFunctionTerminators (Function &F, DomTreeUpdater *DTU)
 
static bool iterativelySimplifyCFG (Function &F, const TargetTransformInfo &TTI, DomTreeUpdater *DTU, const SimplifyCFGOptions &Options)
 Call SimplifyCFG on all the blocks in the function, iterating until no more changes are made.
 
static bool simplifyFunctionCFGImpl (Function &F, const TargetTransformInfo &TTI, DominatorTree *DT, const SimplifyCFGOptions &Options)
 
static bool simplifyFunctionCFG (Function &F, const TargetTransformInfo &TTI, DominatorTree *DT, const SimplifyCFGOptions &Options)
 
static void applyCommandLineOverridesToOptions (SimplifyCFGOptions &Options)
 
 INITIALIZE_PASS_BEGIN (CFGSimplifyPass, "simplifycfg", "Simplify the CFG", false, false) INITIALIZE_PASS_END(CFGSimplifyPass
 

Variables

static cl::opt< unsignedUserBonusInstThreshold ("bonus-inst-threshold", cl::Hidden, cl::init(1), cl::desc("Control the number of bonus instructions (default = 1)"))
 
static cl::opt< boolUserKeepLoops ("keep-loops", cl::Hidden, cl::init(true), cl::desc("Preserve canonical loop structure (default = true)"))
 
static cl::opt< boolUserSwitchRangeToICmp ("switch-range-to-icmp", cl::Hidden, cl::init(false), cl::desc("Convert switches into an integer range comparison (default = false)"))
 
static cl::opt< boolUserSwitchToLookup ("switch-to-lookup", cl::Hidden, cl::init(false), cl::desc("Convert switches to lookup tables (default = false)"))
 
static cl::opt< boolUserForwardSwitchCond ("forward-switch-cond", cl::Hidden, cl::init(false), cl::desc("Forward switch condition to phi ops (default = false)"))
 
static cl::opt< boolUserHoistCommonInsts ("hoist-common-insts", cl::Hidden, cl::init(false), cl::desc("hoist common instructions (default = false)"))
 
static cl::opt< boolUserSinkCommonInsts ("sink-common-insts", cl::Hidden, cl::init(false), cl::desc("Sink common instructions (default = false)"))
 
static cl::opt< boolUserSpeculateUnpredictables ("speculate-unpredictables", cl::Hidden, cl::init(false), cl::desc("Speculate unpredictable branches (default = false)"))
 
 simplifycfg
 
Simplify the CFG
 
Simplify the false
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "simplifycfg"

Definition at line 49 of file SimplifyCFGPass.cpp.

Function Documentation

◆ applyCommandLineOverridesToOptions()

static void applyCommandLineOverridesToOptions ( SimplifyCFGOptions Options)
static

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( CFGSimplifyPass  ,
"simplifycfg"  ,
"Simplify the CFG"  ,
false  ,
false   
)

◆ iterativelySimplifyCFG()

static bool iterativelySimplifyCFG ( Function F,
const TargetTransformInfo TTI,
DomTreeUpdater DTU,
const SimplifyCFGOptions Options 
)
static

◆ performBlockTailMerging()

static bool performBlockTailMerging ( Function F,
ArrayRef< BasicBlock * >  BBs,
std::vector< DominatorTree::UpdateType > *  Updates 
)
static

◆ simplifyFunctionCFG()

static bool simplifyFunctionCFG ( Function F,
const TargetTransformInfo TTI,
DominatorTree DT,
const SimplifyCFGOptions Options 
)
static

◆ simplifyFunctionCFGImpl()

static bool simplifyFunctionCFGImpl ( Function F,
const TargetTransformInfo TTI,
DominatorTree DT,
const SimplifyCFGOptions Options 
)
static

◆ STATISTIC()

STATISTIC ( NumSimpl  ,
"Number of blocks simplified"   
)

◆ tailMergeBlocksWithSimilarFunctionTerminators()

static bool tailMergeBlocksWithSimilarFunctionTerminators ( Function F,
DomTreeUpdater DTU 
)
static

Variable Documentation

◆ CFG

Simplify the CFG

Definition at line 426 of file SimplifyCFGPass.cpp.

◆ false

Simplify the false

Definition at line 426 of file SimplifyCFGPass.cpp.

◆ simplifycfg

simplifycfg

Definition at line 426 of file SimplifyCFGPass.cpp.

◆ UserBonusInstThreshold

cl::opt< unsigned > UserBonusInstThreshold("bonus-inst-threshold", cl::Hidden, cl::init(1), cl::desc("Control the number of bonus instructions (default = 1)")) ( "bonus-inst-threshold"  ,
cl::Hidden  ,
cl::init(1)  ,
cl::desc("Control the number of bonus instructions (default = 1)")   
)
static

◆ UserForwardSwitchCond

cl::opt< bool > UserForwardSwitchCond("forward-switch-cond", cl::Hidden, cl::init(false), cl::desc("Forward switch condition to phi ops (default = false)")) ( "forward-switch-cond"  ,
cl::Hidden  ,
cl::init(false)  ,
cl::desc("Forward switch condition to phi ops (default = false)")   
)
static

◆ UserHoistCommonInsts

cl::opt< bool > UserHoistCommonInsts("hoist-common-insts", cl::Hidden, cl::init(false), cl::desc("hoist common instructions (default = false)")) ( "hoist-common-insts"  ,
cl::Hidden  ,
cl::init(false)  ,
cl::desc("hoist common instructions (default = false)")   
)
static

◆ UserKeepLoops

cl::opt< bool > UserKeepLoops("keep-loops", cl::Hidden, cl::init(true), cl::desc("Preserve canonical loop structure (default = true)")) ( "keep-loops"  ,
cl::Hidden  ,
cl::init(true ,
cl::desc("Preserve canonical loop structure (default = true)")   
)
static

◆ UserSinkCommonInsts

cl::opt< bool > UserSinkCommonInsts("sink-common-insts", cl::Hidden, cl::init(false), cl::desc("Sink common instructions (default = false)")) ( "sink-common-insts"  ,
cl::Hidden  ,
cl::init(false)  ,
cl::desc("Sink common instructions (default = false)")   
)
static

◆ UserSpeculateUnpredictables

cl::opt< bool > UserSpeculateUnpredictables("speculate-unpredictables", cl::Hidden, cl::init(false), cl::desc("Speculate unpredictable branches (default = false)")) ( "speculate-unpredictables"  ,
cl::Hidden  ,
cl::init(false)  ,
cl::desc("Speculate unpredictable branches (default = false)")   
)
static

◆ UserSwitchRangeToICmp

cl::opt< bool > UserSwitchRangeToICmp("switch-range-to-icmp", cl::Hidden, cl::init(false), cl::desc( "Convert switches into an integer range comparison (default = false)")) ( "switch-range-to-icmp"  ,
cl::Hidden  ,
cl::init(false)  ,
cl::desc( "Convert switches into an integer range comparison (default = false)")   
)
static

◆ UserSwitchToLookup

cl::opt< bool > UserSwitchToLookup("switch-to-lookup", cl::Hidden, cl::init(false), cl::desc("Convert switches to lookup tables (default = false)")) ( "switch-to-lookup"  ,
cl::Hidden  ,
cl::init(false)  ,
cl::desc("Convert switches to lookup tables (default = false)")   
)
static