[polly] r312324 - Fix Memory Access of failing tests.

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 1 04:36:52 PDT 2017


Author: meinersbur
Date: Fri Sep  1 04:36:52 2017
New Revision: 312324

URL: http://llvm.org/viewvc/llvm-project?rev=312324&view=rev
Log:
Fix Memory Access of failing tests.

Mark scalar dependences for different statements belonging to same BB
as 'Inter'.

Contributed-by: Nandini Singhal <cs15mtech01004 at iith.ac.in>

Differential Revision: https://reviews.llvm.org/D37147

Added:
    polly/trunk/test/ScopInfo/stmt_split_no_after_split.ll
    polly/trunk/test/ScopInfo/stmt_split_scalar_dependence.ll
Modified:
    polly/trunk/lib/Analysis/ScopInfo.cpp
    polly/trunk/lib/Support/VirtualInstruction.cpp

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=312324&r1=312323&r2=312324&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Fri Sep  1 04:36:52 2017
@@ -3604,7 +3604,13 @@ void Scop::removeFromStmtMap(ScopStmt &S
         InstStmtMap.erase(&Inst);
     }
   } else {
-    StmtMap.erase(Stmt.getBasicBlock());
+    auto StmtMapIt = StmtMap.find(Stmt.getBasicBlock());
+    if (StmtMapIt != StmtMap.end())
+      StmtMapIt->second.erase(std::remove(StmtMapIt->second.begin(),
+                                          StmtMapIt->second.end(), &Stmt),
+                              StmtMapIt->second.end());
+    for (Instruction *Inst : Stmt.getInstructions())
+      InstStmtMap.erase(Inst);
   }
 }
 

Modified: polly/trunk/lib/Support/VirtualInstruction.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/VirtualInstruction.cpp?rev=312324&r1=312323&r2=312324&view=diff
==============================================================================
--- polly/trunk/lib/Support/VirtualInstruction.cpp (original)
+++ polly/trunk/lib/Support/VirtualInstruction.cpp Fri Sep  1 04:36:52 2017
@@ -78,7 +78,7 @@ VirtualUse VirtualUse::create(Scop *S, S
   // A use is inter-statement if either it is defined in another statement, or
   // there is a MemoryAccess that reads its value that has been written by
   // another statement.
-  if (InputMA || (!Virtual && !UserStmt->represents(Inst->getParent())))
+  if (InputMA || (!Virtual && UserStmt != S->getStmtFor(Inst)))
     return VirtualUse(UserStmt, Val, Inter, nullptr, InputMA);
 
   return VirtualUse(UserStmt, Val, Intra, nullptr, nullptr);

Added: polly/trunk/test/ScopInfo/stmt_split_no_after_split.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/stmt_split_no_after_split.ll?rev=312324&view=auto
==============================================================================
--- polly/trunk/test/ScopInfo/stmt_split_no_after_split.ll (added)
+++ polly/trunk/test/ScopInfo/stmt_split_no_after_split.ll Fri Sep  1 04:36:52 2017
@@ -0,0 +1,43 @@
+; RUN: opt %loadPolly -polly-scops -analyze -polly-print-instructions < %s | FileCheck %s
+;
+; CHECK:    Statements {
+; CHECK-NEXT: 	Stmt_Stmt
+; CHECK-NEXT:       Domain :=
+; CHECK-NEXT:           { Stmt_Stmt[i0] : 0 <= i0 <= 1023 };
+; CHECK-NEXT:       Schedule :=
+; CHECK-NEXT:           { Stmt_Stmt[i0] -> [i0] };
+; CHECK-NEXT:       MustWriteAccess :=	[Reduction Type: NONE] [Scalar: 0]
+; CHECK-NEXT:           { Stmt_Stmt[i0] -> MemRef_A[i0] };
+; CHECK-NEXT:       Instructions {
+; CHECK-NEXT:             store i32 %i.0, i32* %arrayidx, align 4, !polly_split_after !0
+; CHECK-NEXT:       }
+; CHECK-NEXT:   }
+;
+; Function Attrs: noinline nounwind uwtable
+define void @func(i32* %A) #0 {
+entry:
+  br label %for.cond
+
+for.cond:                                         ; preds = %for.inc, %entry
+  %i.0 = phi i32 [ 0, %entry ], [ %add, %for.inc ]
+  %cmp = icmp slt i32 %i.0, 1024
+  br i1 %cmp, label %for.body, label %for.end
+
+for.body:                                         ; preds = %for.cond
+  br label %Stmt
+
+Stmt:
+  %idxprom = sext i32 %i.0 to i64
+  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %idxprom
+  store i32 %i.0, i32* %arrayidx, align 4, !polly_split_after !0
+  br label %for.inc
+
+for.inc:                                          ; preds = %Stmt
+  %add = add nsw i32 %i.0, 1
+  br label %for.cond
+
+for.end:                                          ; preds = %for.cond
+  ret void
+}
+
+!0 = !{!"polly_split_after"}

Added: polly/trunk/test/ScopInfo/stmt_split_scalar_dependence.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/stmt_split_scalar_dependence.ll?rev=312324&view=auto
==============================================================================
--- polly/trunk/test/ScopInfo/stmt_split_scalar_dependence.ll (added)
+++ polly/trunk/test/ScopInfo/stmt_split_scalar_dependence.ll Fri Sep  1 04:36:52 2017
@@ -0,0 +1,60 @@
+; RUN: opt %loadPolly -polly-scops -analyze -polly-print-instructions < %s | FileCheck %s
+;
+; CHECK:    Statements {
+; CHECK-NEXT:  	Stmt_Stmt
+; CHECK-NEXT:       Domain :=
+; CHECK-NEXT:           { Stmt_Stmt[i0] : 0 <= i0 <= 1023 };
+; CHECK-NEXT:       Schedule :=
+; CHECK-NEXT:           { Stmt_Stmt[i0] -> [i0, 0] };
+; CHECK-NEXT:       MustWriteAccess :=	[Reduction Type: NONE] [Scalar: 0]
+; CHECK-NEXT:           { Stmt_Stmt[i0] -> MemRef_A[i0] };
+; CHECK-NEXT:       MustWriteAccess :=	[Reduction Type: NONE] [Scalar: 1]
+; CHECK-NEXT:           { Stmt_Stmt[i0] -> MemRef_a[] };
+; CHECK-NEXT:       Instructions {
+; CHECK-NEXT:             %a = fadd double 2.100000e+01, 2.100000e+01
+; CHECK-NEXT:             store i32 %i.0, i32* %arrayidx, align 4, !polly_split_after !0
+; CHECK-NEXT:       }
+; CHECK-NEXT:   Stmt_Stmt1
+; CHECK-NEXT:       Domain :=
+; CHECK-NEXT:           { Stmt_Stmt1[i0] : 0 <= i0 <= 1023 };
+; CHECK-NEXT:       Schedule :=
+; CHECK-NEXT:           { Stmt_Stmt1[i0] -> [i0, 1] };
+; CHECK-NEXT:       MustWriteAccess :=	[Reduction Type: NONE] [Scalar: 0]
+; CHECK-NEXT:           { Stmt_Stmt1[i0] -> MemRef_B[0] };
+; CHECK-NEXT:       ReadAccess :=  [Reduction Type: NONE] [Scalar: 1]
+; CHECK-NEXT:           { Stmt_Stmt1[i0] -> MemRef_a[] };
+; CHECK-NEXT:       Instructions {
+; CHECK-NEXT:             store double %a, double* %B
+; CHECK-NEXT:       }
+; CHECK-NEXT:   }
+;
+; Function Attrs: noinline nounwind uwtable
+define void @func(i32* %A, double* %B) #0 {
+entry:
+  br label %for.cond
+
+for.cond:                                         ; preds = %for.inc, %entry
+  %i.0 = phi i32 [ 0, %entry ], [ %add, %for.inc ]
+  %cmp = icmp slt i32 %i.0, 1024
+  br i1 %cmp, label %for.body, label %for.end
+
+for.body:                                         ; preds = %for.cond
+  br label %Stmt
+
+Stmt:
+  %a = fadd double 21.0, 21.0
+  %idxprom = sext i32 %i.0 to i64
+  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %idxprom
+  store i32 %i.0, i32* %arrayidx, align 4, !polly_split_after !0
+  store double %a, double* %B
+  br label %for.inc
+
+for.inc:                                          ; preds = %Stmt
+  %add = add nsw i32 %i.0, 1
+  br label %for.cond
+
+for.end:                                          ; preds = %for.cond
+  ret void
+}
+
+!0 = !{!"polly_split_after"}




More information about the llvm-commits mailing list