[polly] r249543 - IRBuilder: Simplify code and reduce indention [NFC]
Tobias Grosser via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 7 06:19:04 PDT 2015
Author: grosser
Date: Wed Oct 7 08:19:03 2015
New Revision: 249543
URL: http://llvm.org/viewvc/llvm-project?rev=249543&view=rev
Log:
IRBuilder: Simplify code and reduce indention [NFC]
Modified:
polly/trunk/lib/CodeGen/IRBuilder.cpp
Modified: polly/trunk/lib/CodeGen/IRBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IRBuilder.cpp?rev=249543&r1=249542&r2=249543&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IRBuilder.cpp (original)
+++ polly/trunk/lib/CodeGen/IRBuilder.cpp Wed Oct 7 08:19:03 2015
@@ -124,32 +124,36 @@ void ScopAnnotator::annotate(Instruction
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 (BasePtr) {
- 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);
- }
- }
+ if (!AliasScopeDomain)
+ return;
+
+ if (!(isa<StoreInst>(Inst) || isa<LoadInst>(Inst)))
+ return;
+
+ auto *PtrSCEV = SE->getSCEV(getPointerOperand(*Inst));
+ auto *BaseSCEV = SE->getPointerBase(PtrSCEV);
+ auto *SU = dyn_cast<SCEVUnknown>(BaseSCEV);
- if (ParallelLoops.empty())
+ if (!SU)
return;
- Inst->setMetadata("llvm.mem.parallel_loop_access", ParallelLoops.back());
+ auto *BasePtr = SU->getValue();
+
+ if (!BasePtr)
+ return;
+
+ 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);
}
More information about the llvm-commits
mailing list