summaryrefslogtreecommitdiffstats
path: root/polly/lib/CodeGen/IRBuilder.cpp
diff options
context:
space:
mode:
authorTobias Grosser <tobias@grosser.es>2015-10-07 13:19:03 +0000
committerTobias Grosser <tobias@grosser.es>2015-10-07 13:19:03 +0000
commit73725b8ba591027dc12a538c40b87640f6af273a (patch)
tree58d014744770baac3a9b230254a494ad7fe969c9 /polly/lib/CodeGen/IRBuilder.cpp
parent8e1ecca2ecbc8f95106c95e0fb6f16ff0f4e57f8 (diff)
downloadbcm5719-llvm-73725b8ba591027dc12a538c40b87640f6af273a.tar.gz
bcm5719-llvm-73725b8ba591027dc12a538c40b87640f6af273a.zip
IRBuilder: Simplify code and reduce indention [NFC]
llvm-svn: 249543
Diffstat (limited to 'polly/lib/CodeGen/IRBuilder.cpp')
-rw-r--r--polly/lib/CodeGen/IRBuilder.cpp44
1 files changed, 24 insertions, 20 deletions
diff --git a/polly/lib/CodeGen/IRBuilder.cpp b/polly/lib/CodeGen/IRBuilder.cpp
index 8374ae673cd..7eb1e08c0bb 100644
--- a/polly/lib/CodeGen/IRBuilder.cpp
+++ b/polly/lib/CodeGen/IRBuilder.cpp
@@ -124,32 +124,36 @@ void ScopAnnotator::annotate(Instruction *Inst) {
if (!Inst->mayReadOrWriteMemory())
return;
+ if (!ParallelLoops.empty())
+ Inst->setMetadata("llvm.mem.parallel_loop_access", ParallelLoops.back());
+
// TODO: Use the ScopArrayInfo once available here.
- if (AliasScopeDomain) {
- Value *BasePtr = nullptr;
- if (isa<StoreInst>(Inst) || isa<LoadInst>(Inst)) {
- const SCEV *PtrSCEV = SE->getSCEV(getPointerOperand(*Inst));
- const SCEV *BaseSCEV = SE->getPointerBase(PtrSCEV);
- if (const SCEVUnknown *SU = dyn_cast<SCEVUnknown>(BaseSCEV))
- BasePtr = SU->getValue();
- }
+ if (!AliasScopeDomain)
+ return;
- if (BasePtr) {
- auto *AliasScope = AliasScopeMap[BasePtr];
+ if (!(isa<StoreInst>(Inst) || isa<LoadInst>(Inst)))
+ return;
- if (!AliasScope)
- BasePtr = AlternativeAliasBases[BasePtr];
+ auto *PtrSCEV = SE->getSCEV(getPointerOperand(*Inst));
+ auto *BaseSCEV = SE->getPointerBase(PtrSCEV);
+ auto *SU = dyn_cast<SCEVUnknown>(BaseSCEV);
- AliasScope = AliasScopeMap[BasePtr];
- auto *OtherAliasScopeList = OtherAliasScopeListMap[BasePtr];
+ if (!SU)
+ return;
- Inst->setMetadata("alias.scope", AliasScope);
- Inst->setMetadata("noalias", OtherAliasScopeList);
- }
- }
+ auto *BasePtr = SU->getValue();
- if (ParallelLoops.empty())
+ if (!BasePtr)
return;
- Inst->setMetadata("llvm.mem.parallel_loop_access", ParallelLoops.back());
+ auto *AliasScope = AliasScopeMap[BasePtr];
+
+ if (!AliasScope)
+ BasePtr = AlternativeAliasBases[BasePtr];
+
+ AliasScope = AliasScopeMap[BasePtr];
+ auto *OtherAliasScopeList = OtherAliasScopeListMap[BasePtr];
+
+ Inst->setMetadata("alias.scope", AliasScope);
+ Inst->setMetadata("noalias", OtherAliasScopeList);
}
OpenPOWER on IntegriCloud