diff options
| author | Michael Kruse <llvm@meinersbur.de> | 2017-06-19 10:19:29 +0000 |
|---|---|---|
| committer | Michael Kruse <llvm@meinersbur.de> | 2017-06-19 10:19:29 +0000 |
| commit | 214deb7960ade0817276733cbe55f63b51fa44f7 (patch) | |
| tree | 1adbd68bb8eb444cdeb4f05a8a8f2cc854020e0e /polly/lib/CodeGen | |
| parent | 4aac459ca6642f21b685dc18e3b70039339e8036 (diff) | |
| download | bcm5719-llvm-214deb7960ade0817276733cbe55f63b51fa44f7.tar.gz bcm5719-llvm-214deb7960ade0817276733cbe55f63b51fa44f7.zip | |
[CodeGen] Emit aliasing metadata for new arrays.
Ensure that all array base pointers are assigned before generating
aliasing metadata by allocating new arrays beforehand.
Before this patch, getBasePtr() returned nullptr for new arrays because
the arrays were created at a later point. Nullptr did not match to any
array after the created array base pointers have been assigned and when
the loads/stores are generated.
llvm-svn: 305675
Diffstat (limited to 'polly/lib/CodeGen')
| -rw-r--r-- | polly/lib/CodeGen/CodeGeneration.cpp | 7 | ||||
| -rw-r--r-- | polly/lib/CodeGen/IRBuilder.cpp | 4 |
2 files changed, 8 insertions, 3 deletions
diff --git a/polly/lib/CodeGen/CodeGeneration.cpp b/polly/lib/CodeGen/CodeGeneration.cpp index b60cc7cd246..5569378982f 100644 --- a/polly/lib/CodeGen/CodeGeneration.cpp +++ b/polly/lib/CodeGen/CodeGeneration.cpp @@ -162,7 +162,6 @@ static bool CodeGen(Scop &S, IslAstInfo &AI, LoopInfo &LI, DominatorTree &DT, assert(!R->isTopLevelRegion() && "Top level regions are not supported"); ScopAnnotator Annotator; - Annotator.buildAliasScopes(S); simplifyRegion(R, &DT, &LI, &RI); assert(R->isSimple()); @@ -183,6 +182,11 @@ static bool CodeGen(Scop &S, IslAstInfo &AI, LoopInfo &LI, DominatorTree &DT, IslNodeBuilder NodeBuilder(Builder, Annotator, DL, LI, SE, DT, S, StartBlock); + // All arrays must have their base pointers known before + // ScopAnnotator::buildAliasScopes. + NodeBuilder.allocateNewArrays(); + Annotator.buildAliasScopes(S); + if (PerfMonitoring) { PerfMonitor P(S, EnteringBB->getParent()->getParent()); P.initialize(); @@ -224,7 +228,6 @@ static bool CodeGen(Scop &S, IslAstInfo &AI, LoopInfo &LI, DominatorTree &DT, isl_ast_node_free(AstRoot); } else { - NodeBuilder.allocateNewArrays(); NodeBuilder.addParameters(S.getContext()); Value *RTC = NodeBuilder.createRTC(AI.getRunCondition()); diff --git a/polly/lib/CodeGen/IRBuilder.cpp b/polly/lib/CodeGen/IRBuilder.cpp index a8fb1fdf281..7e8c3ad84d9 100644 --- a/polly/lib/CodeGen/IRBuilder.cpp +++ b/polly/lib/CodeGen/IRBuilder.cpp @@ -67,10 +67,12 @@ void ScopAnnotator::buildAliasScopes(Scop &S) { return; std::string AliasScopeStr = "polly.alias.scope."; - for (const ScopArrayInfo *Array : S.arrays()) + for (const ScopArrayInfo *Array : S.arrays()) { + assert(Array->getBasePtr() && "Base pointer must be present"); AliasScopeMap[Array->getBasePtr()] = getID(Ctx, AliasScopeDomain, MDString::get(Ctx, (AliasScopeStr + Array->getName()).c_str())); + } for (const ScopArrayInfo *Array : S.arrays()) { MDNode *AliasScopeList = MDNode::get(Ctx, {}); |

