LLVM 22.0.0git
TailRecursionElimination.cpp File Reference

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "tailcallelim"

Functions

 STATISTIC (NumEliminated, "Number of tail calls removed")
 STATISTIC (NumRetDuped, "Number of return duplicated")
 STATISTIC (NumAccumAdded, "Number of accumulators introduced")
static bool canTRE (Function &F)
 Scan the specified function for alloca instructions.
static bool markTails (Function &F, OptimizationRemarkEmitter *ORE)
static bool canMoveAboveCall (Instruction *I, CallInst *CI, AliasAnalysis *AA)
 Return true if it is safe to move the specified instruction from after the call to before the call, assuming that all instructions between the call and this instruction are movable.
static bool canTransformAccumulatorRecursion (Instruction *I, CallInst *CI)
 INITIALIZE_PASS_BEGIN (TailCallElim, "tailcallelim", "Tail Call Elimination", false, false) INITIALIZE_PASS_END(TailCallElim

Variables

static cl::opt< boolForceDisableBFI ("tre-disable-entrycount-recompute", cl::init(false), cl::Hidden, cl::desc("Force disabling recomputing of function entry count, on " "successful tail recursion elimination."))
 tailcallelim
Tail Call Elimination
Tail Call false

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "tailcallelim"

Definition at line 87 of file TailRecursionElimination.cpp.

Function Documentation

◆ canMoveAboveCall()

bool canMoveAboveCall ( Instruction * I,
CallInst * CI,
AliasAnalysis * AA )
static

Return true if it is safe to move the specified instruction from after the call to before the call, assuming that all instructions between the call and this instruction are movable.

Definition at line 344 of file TailRecursionElimination.cpp.

References DL, llvm::dyn_cast(), llvm::MemoryLocation::get(), I, II, llvm::is_contained(), llvm::isModSet(), llvm::isSafeToLoadUnconditionally(), and llvm::Instruction::mayHaveSideEffects().

◆ canTransformAccumulatorRecursion()

bool canTransformAccumulatorRecursion ( Instruction * I,
CallInst * CI )
static

◆ canTRE()

bool canTRE ( Function & F)
static

Scan the specified function for alloca instructions.

If it contains any dynamic allocas, returns false.

Definition at line 100 of file TailRecursionElimination.cpp.

References llvm::all_of(), llvm::dyn_cast(), F, I, and instructions.

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( TailCallElim ,
"tailcallelim" ,
"Tail Call Elimination" ,
false ,
false  )

◆ markTails()

◆ STATISTIC() [1/3]

STATISTIC ( NumAccumAdded ,
"Number of accumulators introduced"  )

◆ STATISTIC() [2/3]

STATISTIC ( NumEliminated ,
"Number of tail calls removed"  )

◆ STATISTIC() [3/3]

STATISTIC ( NumRetDuped ,
"Number of return duplicated"  )

Variable Documentation

◆ Elimination

Tail Call Elimination

Definition at line 977 of file TailRecursionElimination.cpp.

◆ false

Tail Call false

Definition at line 978 of file TailRecursionElimination.cpp.

◆ ForceDisableBFI

cl::opt< bool > ForceDisableBFI("tre-disable-entrycount-recompute", cl::init(false), cl::Hidden, cl::desc("Force disabling recomputing of function entry count, on " "successful tail recursion elimination.")) ( "tre-disable-entrycount-recompute" ,
cl::init(false) ,
cl::Hidden ,
cl::desc("Force disabling recomputing of function entry count, on " "successful tail recursion elimination.")  )
static

◆ tailcallelim

tailcallelim

Definition at line 977 of file TailRecursionElimination.cpp.