diff options
author | Raghesh Aloor <raghesh.a@gmail.com> | 2011-08-03 13:47:59 +0000 |
---|---|---|
committer | Raghesh Aloor <raghesh.a@gmail.com> | 2011-08-03 13:47:59 +0000 |
commit | 7a04f4f9ba90e552fdb3ded6eba5ddf07c71a5b8 (patch) | |
tree | 0727f9cf21979d949d906ecc17d7b44ebc5b37c9 | |
parent | 24a01962af6409f9f18403e715db767518c71b43 (diff) | |
download | bcm5719-llvm-7a04f4f9ba90e552fdb3ded6eba5ddf07c71a5b8.tar.gz bcm5719-llvm-7a04f4f9ba90e552fdb3ded6eba5ddf07c71a5b8.zip |
Memaccess: Display Changed Access Relation
The changed access relations imported from JSCOP file is shown
as output of -analyze pass.
llvm-svn: 136774
-rw-r--r-- | polly/lib/Analysis/ScopInfo.cpp | 4 | ||||
-rwxr-xr-x | polly/lib/Exchange/JSONExporter.cpp | 5 | ||||
-rw-r--r-- | polly/test/CodeGen/MemAccess/memaccess_simple_analyze.ll | 48 |
3 files changed, 55 insertions, 2 deletions
diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp index 270f9e5fe12..7e6b0428e68 100644 --- a/polly/lib/Analysis/ScopInfo.cpp +++ b/polly/lib/Analysis/ScopInfo.cpp @@ -337,8 +337,8 @@ bool MemoryAccess::isStrideOne(const isl_set *domainSubset) const { return isl_set_is_equal(stride, strideZero); } -void MemoryAccess::setNewAccessFunction(isl_map *newAccessRelation) { - newAccessRelation = newAccessRelation; +void MemoryAccess::setNewAccessFunction(isl_map *newAccess) { + newAccessRelation = newAccess; } //===----------------------------------------------------------------------===// diff --git a/polly/lib/Exchange/JSONExporter.cpp b/polly/lib/Exchange/JSONExporter.cpp index 0a1a0d447fe..ff4803883c3 100755 --- a/polly/lib/Exchange/JSONExporter.cpp +++ b/polly/lib/Exchange/JSONExporter.cpp @@ -69,6 +69,7 @@ struct JSONExporter : public ScopPass { struct JSONImporter : public ScopPass { static char ID; Scop *S; + std::vector<std::string> newAccessStrings; explicit JSONImporter() : ScopPass(ID) {} std::string getFileName(Scop *S) const; @@ -189,6 +190,9 @@ std::string JSONImporter::getFileName(Scop *S) const { void JSONImporter::printScop(raw_ostream &OS) const { S->print(OS); + for (std::vector<std::string>::const_iterator I = newAccessStrings.begin(), + E = newAccessStrings.end(); I != E; I++) + OS << "New access function '" << *I << "'detected in JSCOP file\n"; } typedef Dependences::StatementToIslMapTy StatementToIslMapTy; @@ -268,6 +272,7 @@ bool JSONImporter::runOnScop(Scop &scop) { if (!isl_map_is_equal(newAccessMap, currentAccessMap)) { // Statistics. ++NewAccessMapFound; + newAccessStrings.push_back(accesses.asCString()); (*MI)->setNewAccessFunction(newAccessMap); } memoryAccessIdx++; diff --git a/polly/test/CodeGen/MemAccess/memaccess_simple_analyze.ll b/polly/test/CodeGen/MemAccess/memaccess_simple_analyze.ll new file mode 100644 index 00000000000..54bc6e9e159 --- /dev/null +++ b/polly/test/CodeGen/MemAccess/memaccess_simple_analyze.ll @@ -0,0 +1,48 @@ +;RUN: opt %loadPolly -polly-import-jscop -analyze -polly-import-jscop-dir=`dirname %s` -polly-import-jscop-postfix=transformed %s | FileCheck %s +; ModuleID = 'memaccess_simple.ll' +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32" +target triple = "i386-pc-linux-gnu" + +@A = common global [100 x i32] zeroinitializer, align 4 +@B = common global [100 x i32] zeroinitializer, align 4 + +define i32 @memaccess_simple() nounwind { +entry: + br label %for.cond + +for.cond: ; preds = %for.inc, %entry + %0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ] + %arrayidx = getelementptr [100 x i32]* @A, i32 0, i32 %0 + %exitcond1 = icmp ne i32 %0, 12 + br i1 %exitcond1, label %for.body, label %for.end + +for.body: ; preds = %for.cond + store i32 %0, i32* %arrayidx + br label %for.inc + +for.inc: ; preds = %for.body + %inc = add nsw i32 %0, 1 + br label %for.cond + +for.end: ; preds = %for.cond + br label %for.cond4 + +for.cond4: ; preds = %for.inc11, %for.end + %1 = phi i32 [ 0, %for.end ], [ %inc13, %for.inc11 ] + %arrayidx10 = getelementptr [100 x i32]* @B, i32 0, i32 %1 + %exitcond = icmp ne i32 %1, 12 + br i1 %exitcond, label %for.body7, label %for.end14 + +for.body7: ; preds = %for.cond4 + store i32 %1, i32* %arrayidx10 + br label %for.inc11 + +for.inc11: ; preds = %for.body7 + %inc13 = add nsw i32 %1, 1 + br label %for.cond4 + +for.end14: ; preds = %for.cond4 + ret i32 0 +} +; CHECK: New access function '{ Stmt_for_body7[i0] -> MemRef_B[0] }'detected in JSCOP file +; CHECK: New access function '{ Stmt_for_body[i0] -> MemRef_A[0] }'detected in JSCOP file |