Changeset View
Changeset View
Standalone View
Standalone View
lib/Analysis/ScopInfo.cpp
Show First 20 Lines • Show All 162 Lines • ▼ Show 20 Lines | PollyIgnoreInbounds("polly-ignore-inbounds", | ||||
cl::Hidden, cl::init(false), cl::cat(PollyCategory)); | cl::Hidden, cl::init(false), cl::cat(PollyCategory)); | ||||
static cl::opt<bool> PollyIgnoreParamBounds( | static cl::opt<bool> PollyIgnoreParamBounds( | ||||
"polly-ignore-parameter-bounds", | "polly-ignore-parameter-bounds", | ||||
cl::desc( | cl::desc( | ||||
"Do not add parameter bounds and do no gist simplify sets accordingly"), | "Do not add parameter bounds and do no gist simplify sets accordingly"), | ||||
cl::Hidden, cl::init(false), cl::cat(PollyCategory)); | cl::Hidden, cl::init(false), cl::cat(PollyCategory)); | ||||
static cl::opt<bool> PollyAllowDereferenceOfAllFunctionParams( | |||||
"polly-allow-dereference-of-all-function-parameters", | |||||
cl::desc( | |||||
"Treat all parameters to functions that are pointers as dereferencible." | |||||
" This is useful for invariant load hoisting, since we can generate" | |||||
" less runtime checks. This is only valid if all pointers to functions" | |||||
" are always initialized, so that Polly can choose to hoist" | |||||
" their loads. "), | |||||
cl::Hidden, cl::init(false), cl::cat(PollyCategory)); | |||||
static cl::opt<bool> PollyPreciseFoldAccesses( | static cl::opt<bool> PollyPreciseFoldAccesses( | ||||
"polly-precise-fold-accesses", | "polly-precise-fold-accesses", | ||||
cl::desc("Fold memory accesses to model more possible delinearizations " | cl::desc("Fold memory accesses to model more possible delinearizations " | ||||
"(does not scale well)"), | "(does not scale well)"), | ||||
cl::Hidden, cl::init(false), cl::cat(PollyCategory)); | cl::Hidden, cl::init(false), cl::cat(PollyCategory)); | ||||
bool polly::UseInstructionNames; | bool polly::UseInstructionNames; | ||||
static cl::opt<bool, true> XUseInstructionNames( | static cl::opt<bool, true> XUseInstructionNames( | ||||
▲ Show 20 Lines • Show All 3,643 Lines • ▼ Show 20 Lines | for (auto &IAClass : InvariantEquivClasses) { | ||||
for (auto *MA : MAs) | for (auto *MA : MAs) | ||||
if (MA->getAccessInstruction() == Val) | if (MA->getAccessInstruction() == Val) | ||||
return &IAClass; | return &IAClass; | ||||
} | } | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
bool isAParameter(llvm::Value *maybeParam, const Function &F) { | |||||
for (const llvm::Argument &Arg : F.args()) | |||||
if (&Arg == maybeParam) | |||||
return true; | |||||
return false; | |||||
}; | |||||
bool Scop::canAlwaysBeHoisted(MemoryAccess *MA, bool StmtInvalidCtxIsEmpty, | bool Scop::canAlwaysBeHoisted(MemoryAccess *MA, bool StmtInvalidCtxIsEmpty, | ||||
bool MAInvalidCtxIsEmpty, | bool MAInvalidCtxIsEmpty, | ||||
bool NonHoistableCtxIsEmpty) { | bool NonHoistableCtxIsEmpty) { | ||||
LoadInst *LInst = cast<LoadInst>(MA->getAccessInstruction()); | LoadInst *LInst = cast<LoadInst>(MA->getAccessInstruction()); | ||||
const DataLayout &DL = LInst->getParent()->getModule()->getDataLayout(); | const DataLayout &DL = LInst->getParent()->getModule()->getDataLayout(); | ||||
if (PollyAllowDereferenceOfAllFunctionParams && | |||||
isAParameter(LInst->getPointerOperand(), getFunction())) | |||||
return true; | |||||
// TODO: We can provide more information for better but more expensive | // TODO: We can provide more information for better but more expensive | ||||
// results. | // results. | ||||
if (!isDereferenceableAndAlignedPointer(LInst->getPointerOperand(), | if (!isDereferenceableAndAlignedPointer(LInst->getPointerOperand(), | ||||
LInst->getAlignment(), DL)) | LInst->getAlignment(), DL)) | ||||
return false; | return false; | ||||
// If the location might be overwritten we do not hoist it unconditionally. | // If the location might be overwritten we do not hoist it unconditionally. | ||||
// | // | ||||
▲ Show 20 Lines • Show All 1,489 Lines • Show Last 20 Lines |