LLVM 17.0.0git
|
#include "llvm/Transforms/Scalar/TailRecursionElimination.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/DomTreeUpdater.h"
#include "llvm/Analysis/GlobalsModRef.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/Loads.h"
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
#include "llvm/Analysis/PostDominators.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/CFG.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/InstIterator.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Module.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
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) |
static Instruction * | firstNonDbg (BasicBlock::iterator I) |
INITIALIZE_PASS_BEGIN (TailCallElim, "tailcallelim", "Tail Call Elimination", false, false) INITIALIZE_PASS_END(TailCallElim | |
Variables | |
tailcallelim | |
Tail Call | Elimination |
Tail Call | false |
#define DEBUG_TYPE "tailcallelim" |
Definition at line 84 of file TailRecursionElimination.cpp.
|
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 331 of file TailRecursionElimination.cpp.
References DL, llvm::findAllocaForValue(), llvm::MemoryLocation::get(), llvm::AAResults::getModRefInfo(), I, llvm::is_contained(), llvm::isModSet(), llvm::isSafeToLoadUnconditionally(), and llvm::Instruction::mayHaveSideEffects().
|
static |
Definition at line 368 of file TailRecursionElimination.cpp.
Scan the specified function for alloca instructions.
If it contains any dynamic allocas, returns false.
Definition at line 92 of file TailRecursionElimination.cpp.
References llvm::all_of(), F, I, and instructions.
|
static |
Definition at line 387 of file TailRecursionElimination.cpp.
References I.
INITIALIZE_PASS_BEGIN | ( | TailCallElim | , |
"tailcallelim" | , | ||
"Tail Call Elimination" | , | ||
false | , | ||
false | |||
) |
|
static |
Definition at line 189 of file TailRecursionElimination.cpp.
References A, Arg, llvm::CallBase::args(), llvm::dbgs(), DEBUG_TYPE, llvm::CallBase::doesNotAccessMemory(), llvm::OptimizationRemarkEmitter::emit(), llvm::SmallVectorBase< Size_T >::empty(), F, llvm::CallBase::hasOperandBundlesOtherThan(), I, llvm::CallInst::isNoTailCall(), llvm::CallInst::isTailCall(), LLVM_DEBUG, Modified, llvm::LLVMContext::OB_clang_arc_attachedcall, llvm::LLVMContext::OB_kcfi, llvm::LLVMContext::OB_ptrauth, llvm::SmallVectorImpl< T >::pop_back_val(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::CallInst::setTailCall(), and llvm::successors().
STATISTIC | ( | NumAccumAdded | , |
"Number of accumulators introduced" | |||
) |
STATISTIC | ( | NumEliminated | , |
"Number of tail calls removed" | |||
) |
STATISTIC | ( | NumRetDuped | , |
"Number of return duplicated" | |||
) |
Tail Call Elimination |
Definition at line 913 of file TailRecursionElimination.cpp.
Tail Call false |
Definition at line 914 of file TailRecursionElimination.cpp.
tailcallelim |
Definition at line 913 of file TailRecursionElimination.cpp.