Exploit BasicBlock::getModule to shorten code

Suggested-by: Roman Gareev <gareevroman@gmail.com>
llvm-svn: 299914
This commit is contained in:
Tobias Grosser 2017-04-11 04:59:13 +00:00
parent 67726b3260
commit 7b5a4dfd46
5 changed files with 5 additions and 9 deletions

View File

@ -344,8 +344,7 @@ bool ScopDetection::addOverApproximatedRegion(Region *AR,
bool ScopDetection::onlyValidRequiredInvariantLoads(
InvariantLoadsSetTy &RequiredILS, DetectionContext &Context) const {
Region &CurRegion = Context.CurRegion;
const DataLayout &DL =
CurRegion.getEntry()->getParent()->getParent()->getDataLayout();
const DataLayout &DL = CurRegion.getEntry()->getModule()->getDataLayout();
if (!PollyInvariantLoadHoisting && !RequiredILS.empty())
return false;

View File

@ -408,8 +408,7 @@ Value *BlockGenerator::getOrCreateAlloca(const ScopArrayInfo *Array) {
else
NameExt = ".s2a";
const DataLayout &DL =
Builder.GetInsertBlock()->getParent()->getParent()->getDataLayout();
const DataLayout &DL = Builder.GetInsertBlock()->getModule()->getDataLayout();
Addr = new AllocaInst(Ty, DL.getAllocaAddrSpace(),
ScalarBase->getName() + NameExt);

View File

@ -281,8 +281,7 @@ ParallelLoopGenerator::storeValuesIntoStruct(SetVector<Value *> &Values) {
for (Value *V : Values)
Members.push_back(V->getType());
const DataLayout &DL =
Builder.GetInsertBlock()->getParent()->getParent()->getDataLayout();
const DataLayout &DL = Builder.GetInsertBlock()->getModule()->getDataLayout();
// We do not want to allocate the alloca inside any loop, thus we allocate it
// in the entry block of the function and use annotations to denote the actual

View File

@ -2447,7 +2447,7 @@ public:
LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
SE = &getAnalysis<ScalarEvolutionWrapperPass>().getSE();
DL = &S->getRegion().getEntry()->getParent()->getParent()->getDataLayout();
DL = &S->getRegion().getEntry()->getModule()->getDataLayout();
RI = &getAnalysis<RegionInfoPass>().getRegionInfo();
// We currently do not support scops with invariant loads.

View File

@ -1465,8 +1465,7 @@ private:
ProcessAllIncoming(TargetStmt);
auto AnyMapped = false;
auto &DL =
S->getRegion().getEntry()->getParent()->getParent()->getDataLayout();
auto &DL = S->getRegion().getEntry()->getModule()->getDataLayout();
auto StoreSize =
DL.getTypeAllocSize(TargetStoreMA->getAccessValue()->getType());