Fixed typo in comment & coding style for LoopVersioningLICM.
llvm-svn: 260504
This commit is contained in:
parent
8b6434e56e
commit
2260a3a046
|
@ -379,7 +379,7 @@ void PassManagerBuilder::populateModulePassManager(
|
||||||
// we must insert a no-op module pass to reset the pass manager.
|
// we must insert a no-op module pass to reset the pass manager.
|
||||||
MPM.add(createBarrierNoopPass());
|
MPM.add(createBarrierNoopPass());
|
||||||
|
|
||||||
// Scheduling LoopVersioningLICM when inining is over, because after that
|
// Scheduling LoopVersioningLICM when inlining is over, because after that
|
||||||
// we may see more accurate aliasing. Reason to run this late is that too
|
// we may see more accurate aliasing. Reason to run this late is that too
|
||||||
// early versioning may prevent further inlining due to increase of code
|
// early versioning may prevent further inlining due to increase of code
|
||||||
// size. By placing it just after inlining other optimizations which runs
|
// size. By placing it just after inlining other optimizations which runs
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
// +--------------------+ +----------------------+
|
// +--------------------+ +----------------------+
|
||||||
// | |
|
// | |
|
||||||
// +--------------------+ +----------------------+
|
// +--------------------+ +----------------------+
|
||||||
// |Orig Loop|Exit Block| |Cloned Loop Exit Block|
|
// |Orig Loop Exit Block| |Cloned Loop Exit Block|
|
||||||
// +--------------------+ +-----------+----------+
|
// +--------------------+ +-----------+----------+
|
||||||
// | |
|
// | |
|
||||||
// +----------+--------------+-----------+
|
// +----------+--------------+-----------+
|
||||||
|
@ -92,21 +92,22 @@
|
||||||
#include "llvm/Transforms/Utils/ValueMapper.h"
|
#include "llvm/Transforms/Utils/ValueMapper.h"
|
||||||
|
|
||||||
#define DEBUG_TYPE "loop-versioning-licm"
|
#define DEBUG_TYPE "loop-versioning-licm"
|
||||||
#define LOOP_VERSIONING_LICM_METADATA "llvm.loop.licm_versioning.disable"
|
static constexpr char LICMVersioningMetaData[] =
|
||||||
|
"llvm.loop.licm_versioning.disable";
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
/// Threshold minimum allowed percentage for possible
|
/// Threshold minimum allowed percentage for possible
|
||||||
/// invariant instructions in a loop.
|
/// invariant instructions in a loop.
|
||||||
static cl::opt<float>
|
static cl::opt<float>
|
||||||
LVInvarThreshold("-licm-versioning-invariant-threshold",
|
LVInvarThreshold("licm-versioning-invariant-threshold",
|
||||||
cl::desc("LoopVersioningLICM's minimum allowed percentage"
|
cl::desc("LoopVersioningLICM's minimum allowed percentage"
|
||||||
"of possible invariant instructions per loop"),
|
"of possible invariant instructions per loop"),
|
||||||
cl::init(25), cl::Hidden);
|
cl::init(25), cl::Hidden);
|
||||||
|
|
||||||
/// Threshold for maximum allowed loop nest/depth
|
/// Threshold for maximum allowed loop nest/depth
|
||||||
static cl::opt<unsigned> LVLoopDepthThreshold(
|
static cl::opt<unsigned> LVLoopDepthThreshold(
|
||||||
"-licm-versioning-max-depth-threshold",
|
"licm-versioning-max-depth-threshold",
|
||||||
cl::desc(
|
cl::desc(
|
||||||
"LoopVersioningLICM's threshold for maximum allowed loop nest/depth"),
|
"LoopVersioningLICM's threshold for maximum allowed loop nest/depth"),
|
||||||
cl::init(2), cl::Hidden);
|
cl::init(2), cl::Hidden);
|
||||||
|
@ -372,7 +373,7 @@ bool LoopVersioningLICM::legalLoopMemoryAccesses() {
|
||||||
bool LoopVersioningLICM::instructionSafeForVersioning(Instruction *I) {
|
bool LoopVersioningLICM::instructionSafeForVersioning(Instruction *I) {
|
||||||
assert(I != nullptr && "Null instruction found!");
|
assert(I != nullptr && "Null instruction found!");
|
||||||
// Check function call safety
|
// Check function call safety
|
||||||
if (dyn_cast<CallInst>(I) && !AA->doesNotAccessMemory(CallSite(I))) {
|
if (isa<CallInst>(I) && !AA->doesNotAccessMemory(CallSite(I))) {
|
||||||
DEBUG(dbgs() << " Unsafe call site found.\n");
|
DEBUG(dbgs() << " Unsafe call site found.\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -427,7 +428,7 @@ bool LoopVersioningLICM::legalLoopInstructions() {
|
||||||
// instruction safety.
|
// instruction safety.
|
||||||
for (auto *Block : CurLoop->getBlocks())
|
for (auto *Block : CurLoop->getBlocks())
|
||||||
for (auto &Inst : *Block) {
|
for (auto &Inst : *Block) {
|
||||||
// If instruction in unsafe just return false.
|
// If instruction is unsafe just return false.
|
||||||
if (!instructionSafeForVersioning(&Inst))
|
if (!instructionSafeForVersioning(&Inst))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -469,11 +470,11 @@ bool LoopVersioningLICM::legalLoopInstructions() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief It checks loop is already visited or not.
|
/// \brief It checks loop is already visited or not.
|
||||||
/// check loop meta data, If loop revisited return true
|
/// check loop meta data, if loop revisited return true
|
||||||
/// else false.
|
/// else false.
|
||||||
bool LoopVersioningLICM::isLoopAlreadyVisited() {
|
bool LoopVersioningLICM::isLoopAlreadyVisited() {
|
||||||
// Check LoopVersioningLICM metadata into loop
|
// Check LoopVersioningLICM metadata into loop
|
||||||
if (checkStringMetadataIntoLoop(CurLoop, LOOP_VERSIONING_LICM_METADATA)) {
|
if (checkStringMetadataIntoLoop(CurLoop, LICMVersioningMetaData)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -585,11 +586,9 @@ bool LoopVersioningLICM::runOnLoop(Loop *L, LPPassManager &LPM) {
|
||||||
LoopVersioning LVer(*LAI, CurLoop, LI, DT, SE, true);
|
LoopVersioning LVer(*LAI, CurLoop, LI, DT, SE, true);
|
||||||
LVer.versionLoop();
|
LVer.versionLoop();
|
||||||
// Set Loop Versioning metaData for original loop.
|
// Set Loop Versioning metaData for original loop.
|
||||||
addStringMetadataToLoop(LVer.getNonVersionedLoop(),
|
addStringMetadataToLoop(LVer.getNonVersionedLoop(), LICMVersioningMetaData);
|
||||||
LOOP_VERSIONING_LICM_METADATA);
|
|
||||||
// Set Loop Versioning metaData for version loop.
|
// Set Loop Versioning metaData for version loop.
|
||||||
addStringMetadataToLoop(LVer.getVersionedLoop(),
|
addStringMetadataToLoop(LVer.getVersionedLoop(), LICMVersioningMetaData);
|
||||||
LOOP_VERSIONING_LICM_METADATA);
|
|
||||||
// Set "llvm.mem.parallel_loop_access" metaData to versioned loop.
|
// Set "llvm.mem.parallel_loop_access" metaData to versioned loop.
|
||||||
addStringMetadataToLoop(LVer.getVersionedLoop(),
|
addStringMetadataToLoop(LVer.getVersionedLoop(),
|
||||||
"llvm.mem.parallel_loop_access");
|
"llvm.mem.parallel_loop_access");
|
||||||
|
|
Loading…
Reference in New Issue