Go to the documentation of this file.
24 #define DEBUG_TYPE "flattencfg"
47 bool LocalChange =
true;
51 std::vector<WeakVH> Blocks;
52 Blocks.reserve(
F.size());
54 Blocks.push_back(&
BB);
60 for (
WeakVH &BlockHandle : Blocks) {
62 if (
auto *
BB = cast_or_null<BasicBlock>(BlockHandle))
66 Changed |= LocalChange;
82 return new FlattenCFGLegacyPass();
86 AA = &getAnalysis<AAResultsWrapperPass>().getAAResults();
87 bool EverChanged =
false;
89 while (iterativelyFlattenCFG(
F,
AA)) {
98 bool EverChanged =
false;
101 while (iterativelyFlattenCFG(
F,
AA)) {
A set of analyses that are preserved following a run of a transformation pass.
A manager for alias analyses.
This is an optimization pass for GlobalISel generic memory operations.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
FunctionPass * createFlattenCFGPass()
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
A nullable Value handle that is nullable.
bool removeUnreachableBlocks(Function &F, DomTreeUpdater *DTU=nullptr, MemorySSAUpdater *MSSAU=nullptr)
Remove all blocks that can not be reached from the function's entry.
void initializeFlattenCFGLegacyPassPass(PassRegistry &)
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
Represent the analysis usage information of a pass.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
INITIALIZE_PASS_BEGIN(FlattenCFGLegacyPass, "flattencfg", "Flatten the CFG", false, false) INITIALIZE_PASS_END(FlattenCFGLegacyPass
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
bool FlattenCFG(BasicBlock *BB, AAResults *AA=nullptr)
This function is used to flatten a CFG.
static bool runOnFunction(Function &F, bool PostInlining)
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
A wrapper pass to provide the legacy pass manager access to a suitably prepared AAResults object.
A container for analyses that lazily runs them and caches their results.
FunctionPass class - This class is used to implement most global optimizations.
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
AnalysisUsage & addRequired()