summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--polly/lib/Analysis/ScopInfo.cpp8
-rw-r--r--polly/lib/Support/VirtualInstruction.cpp2
-rw-r--r--polly/test/ScopInfo/stmt_split_no_after_split.ll43
-rw-r--r--polly/test/ScopInfo/stmt_split_scalar_dependence.ll60
4 files changed, 111 insertions, 2 deletions
diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp
index 18461d08293..298609258ea 100644
--- a/polly/lib/Analysis/ScopInfo.cpp
+++ b/polly/lib/Analysis/ScopInfo.cpp
@@ -3604,7 +3604,13 @@ void Scop::removeFromStmtMap(ScopStmt &Stmt) {
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);
}
}
diff --git a/polly/lib/Support/VirtualInstruction.cpp b/polly/lib/Support/VirtualInstruction.cpp
index 036236afb49..d30a27fd2d5 100644
--- a/polly/lib/Support/VirtualInstruction.cpp
+++ b/polly/lib/Support/VirtualInstruction.cpp
@@ -78,7 +78,7 @@ VirtualUse VirtualUse::create(Scop *S, ScopStmt *UserStmt, Loop *UserScope,
// 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);
diff --git a/polly/test/ScopInfo/stmt_split_no_after_split.ll b/polly/test/ScopInfo/stmt_split_no_after_split.ll
new file mode 100644
index 00000000000..07bf824cd28
--- /dev/null
+++ b/polly/test/ScopInfo/stmt_split_no_after_split.ll
@@ -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"}
diff --git a/polly/test/ScopInfo/stmt_split_scalar_dependence.ll b/polly/test/ScopInfo/stmt_split_scalar_dependence.ll
new file mode 100644
index 00000000000..7ce13c33b6b
--- /dev/null
+++ b/polly/test/ScopInfo/stmt_split_scalar_dependence.ll
@@ -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"}
OpenPOWER on IntegriCloud