LLVM
8.0.1
|
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/LoopIterator.h"
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/Cloning.h"
#include "llvm/Transforms/Utils/LoopSimplify.h"
#include "llvm/Transforms/Utils/LoopUtils.h"
#include "llvm/Transforms/Utils/SimplifyIndVar.h"
#include "llvm/Transforms/Utils/UnrollLoop.h"
Go to the source code of this file.
Macros | |
#define | DEBUG_TYPE "loop-unroll" |
Functions | |
STATISTIC (NumCompletelyUnrolled, "Number of loops completely unrolled") | |
STATISTIC (NumUnrolled, "Number of loops unrolled (completely or otherwise)") | |
static bool | needToInsertPhisForLCSSA (Loop *L, std::vector< BasicBlock *> Blocks, LoopInfo *LI) |
Check if unrolling created a situation where we need to insert phi nodes to preserve LCSSA form. More... | |
static bool | isEpilogProfitable (Loop *L) |
The function chooses which type of unroll (epilog or prolog) is more profitabale. More... | |
Variables | |
static cl::opt< bool > | UnrollRuntimeEpilog ("unroll-runtime-epilog", cl::init(false), cl::Hidden, cl::desc("Allow runtime unrolled loops to be unrolled " "with epilog instead of prolog.")) |
static cl::opt< bool > | UnrollVerifyDomtree ("unroll-verify-domtree", cl::Hidden, cl::desc("Verify domtree after unrolling"), cl::init(false)) |
#define DEBUG_TYPE "loop-unroll" |
Definition at line 43 of file LoopUnroll.cpp.
Referenced by llvm::UnrollLoop().
The function chooses which type of unroll (epilog or prolog) is more profitabale.
Epilog unroll is more profitable when there is PHI that starts from constant. In this case epilog will leave PHI start from constant, but prolog will convert it to non-constant.
loop: PN = PHI [I, Latch], [CI, PreHeader] I = foo(PN) ...
Epilog unroll case. loop: PN = PHI [I2, Latch], [CI, PreHeader] I1 = foo(PN) I2 = foo(I1) ... Prolog unroll case. NewPN = PHI [PrologI, Prolog], [CI, PreHeader] loop: PN = PHI [I2, Latch], [NewPN, PreHeader] I1 = foo(PN) I2 = foo(I1) ...
Definition at line 244 of file LoopUnroll.cpp.
References assert(), llvm::LoopBase< BlockT, LoopT >::getHeader(), llvm::LoopBase< BlockT, LoopT >::getLoopPreheader(), and llvm::BasicBlock::phis().
Referenced by llvm::UnrollLoop().
|
static |
Check if unrolling created a situation where we need to insert phi nodes to preserve LCSSA form.
Blocks | is a vector of basic blocks representing unrolled loop. |
L | is the outer loop. It's possible that some of the blocks are in L, and some are not. In this case, if there is a use is outside L, and definition is inside L, we need to insert a phi-node, otherwise LCSSA will be broken. The function is just a helper function for llvm::UnrollLoop that returns true if this situation occurs, indicating that LCSSA needs to be fixed. |
Definition at line 166 of file LoopUnroll.cpp.
References llvm::LoopBase< BlockT, LoopT >::contains(), llvm::tgtok::Def, llvm::LoopInfoBase< BlockT, LoopT >::getLoopFor(), and I.
Referenced by llvm::UnrollLoop().
STATISTIC | ( | NumCompletelyUnrolled | , |
"Number of loops completely unrolled" | |||
) |
STATISTIC | ( | NumUnrolled | , |
"Number of loops unrolled (completely or otherwise)" | |||
) |
|
static |
Referenced by llvm::UnrollLoop().