[polly] r294574 - [IRBuilder] Extract base pointers directly from ScopArray
Tobias Grosser via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 9 01:34:42 PST 2017
Author: grosser
Date: Thu Feb 9 03:34:42 2017
New Revision: 294574
URL: http://llvm.org/viewvc/llvm-project?rev=294574&view=rev
Log:
[IRBuilder] Extract base pointers directly from ScopArray
Instead of iterating over statements and their memory accesses to extract the
set of available base pointers, just directly iterate over all ScopArray
objects. This reflects more the actual intend of the code: collect all arrays
(and their base pointers) to emit alias information that specifies that accesses
to different arrays cannot alias.
This change removes unnecessary uses of MemoryAddress::getBaseAddr() in
preparation for https://reviews.llvm.org/D28518.
Modified:
polly/trunk/lib/CodeGen/IRBuilder.cpp
polly/trunk/test/Isl/CodeGen/annotated_alias_scopes.ll
Modified: polly/trunk/lib/CodeGen/IRBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IRBuilder.cpp?rev=294574&r1=294573&r2=294574&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IRBuilder.cpp (original)
+++ polly/trunk/lib/CodeGen/IRBuilder.cpp Thu Feb 9 03:34:42 2017
@@ -58,22 +58,16 @@ void ScopAnnotator::buildAliasScopes(Sco
AliasScopeMap.clear();
OtherAliasScopeListMap.clear();
- SetVector<Value *> BasePtrs;
- for (ScopStmt &Stmt : S)
- for (MemoryAccess *MA : Stmt)
- if (!Stmt.isCopyStmt())
- BasePtrs.insert(MA->getBaseAddr());
-
std::string AliasScopeStr = "polly.alias.scope.";
- for (Value *BasePtr : BasePtrs)
- AliasScopeMap[BasePtr] = getID(
- Ctx, AliasScopeDomain,
- MDString::get(Ctx, (AliasScopeStr + BasePtr->getName()).str().c_str()));
+ for (const ScopArrayInfo *Array : S.arrays())
+ AliasScopeMap[Array->getBasePtr()] =
+ getID(Ctx, AliasScopeDomain,
+ MDString::get(Ctx, (AliasScopeStr + Array->getName()).c_str()));
- for (Value *BasePtr : BasePtrs) {
+ for (const ScopArrayInfo *Array : S.arrays()) {
MDNode *AliasScopeList = MDNode::get(Ctx, {});
for (const auto &AliasScopePair : AliasScopeMap) {
- if (BasePtr == AliasScopePair.first)
+ if (Array->getBasePtr() == AliasScopePair.first)
continue;
Metadata *Args = {AliasScopePair.second};
@@ -81,7 +75,7 @@ void ScopAnnotator::buildAliasScopes(Sco
MDNode::concatenate(AliasScopeList, MDNode::get(Ctx, Args));
}
- OtherAliasScopeListMap[BasePtr] = AliasScopeList;
+ OtherAliasScopeListMap[Array->getBasePtr()] = AliasScopeList;
}
}
Modified: polly/trunk/test/Isl/CodeGen/annotated_alias_scopes.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/CodeGen/annotated_alias_scopes.ll?rev=294574&r1=294573&r2=294574&view=diff
==============================================================================
--- polly/trunk/test/Isl/CodeGen/annotated_alias_scopes.ll (original)
+++ polly/trunk/test/Isl/CodeGen/annotated_alias_scopes.ll Thu Feb 9 03:34:42 2017
@@ -10,13 +10,13 @@
; SCOPES: %[[AIdx:[._a-zA-Z0-9]*]] = getelementptr{{.*}} i32* %A, i64 %polly.indvar
; SCOPES: store i32 %{{[._a-zA-Z0-9]*}}, i32* %[[AIdx]], align 4, !alias.scope ![[AliasScopeA:[0-9]*]], !noalias ![[NoAliasA:[0-9]*]]
;
-; SCOPES: ![[AliasScopeB]] = distinct !{![[AliasScopeB]], !{{[0-9]*}}, !"polly.alias.scope.B"}
+; SCOPES: ![[AliasScopeB]] = distinct !{![[AliasScopeB]], !{{[0-9]*}}, !"polly.alias.scope.MemRef_B"}
; SCOPES: ![[NoAliasB]] = !{
; SCOPES-DAG: ![[AliasScopeA]]
; SCOPES-DAG: ![[AliasScopeC]]
; SCOPES: }
-; SCOPES-DAG: ![[AliasScopeA]] = distinct !{![[AliasScopeA]], !{{[0-9]*}}, !"polly.alias.scope.A"}
-; SCOPES-DAG: ![[AliasScopeC]] = distinct !{![[AliasScopeC]], !{{[0-9]*}}, !"polly.alias.scope.C"}
+; SCOPES-DAG: ![[AliasScopeA]] = distinct !{![[AliasScopeA]], !{{[0-9]*}}, !"polly.alias.scope.MemRef_A"}
+; SCOPES-DAG: ![[AliasScopeC]] = distinct !{![[AliasScopeC]], !{{[0-9]*}}, !"polly.alias.scope.MemRef_C"}
; SCOPES: ![[NoAliasC]] = !{
; SCOPES-DAG: ![[AliasScopeA]]
; SCOPES-DAG: ![[AliasScopeB]]
More information about the llvm-commits
mailing list