summaryrefslogtreecommitdiffstats
path: root/polly
diff options
context:
space:
mode:
authorJohannes Doerfert <doerfert@cs.uni-saarland.de>2016-04-03 11:16:00 +0000
committerJohannes Doerfert <doerfert@cs.uni-saarland.de>2016-04-03 11:16:00 +0000
commit2075b5d2a122a3790c05ce12941a738da1a8b205 (patch)
tree44d33225b5f5da0ff78c54046afe83ef8d2a6cfc /polly
parent7dcceb82e9b9799e620923ea05a47f6eb47a3dda (diff)
downloadbcm5719-llvm-2075b5d2a122a3790c05ce12941a738da1a8b205.tar.gz
bcm5719-llvm-2075b5d2a122a3790c05ce12941a738da1a8b205.zip
[FIX] Do not create two SAI objects for exit PHIs
If an exit PHI is written and also read in the SCoP we should not create two SAI objects but only one. As the read is only modeled to ensure OpenMP code generation knows about it we can simply use the EXIT_PHI MemoryKind for both accesses. llvm-svn: 265261
Diffstat (limited to 'polly')
-rw-r--r--polly/lib/Analysis/ScopInfo.cpp8
-rw-r--r--polly/test/ScopInfo/exit-phi-1.ll39
2 files changed, 45 insertions, 2 deletions
diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp
index f3271c20334..7edc1499c47 100644
--- a/polly/lib/Analysis/ScopInfo.cpp
+++ b/polly/lib/Analysis/ScopInfo.cpp
@@ -4334,9 +4334,13 @@ void ScopInfo::ensureValueRead(Value *V, BasicBlock *UserBB) {
if (UserStmt->lookupValueReadOf(V))
return;
+ // For exit PHIs use the MK_ExitPHI MemoryKind not MK_Value.
+ ScopArrayInfo::MemoryKind Kind = ScopArrayInfo::MK_Value;
+ if (!ValueStmt && isa<PHINode>(V))
+ Kind = ScopArrayInfo::MK_ExitPHI;
+
addMemoryAccess(UserBB, nullptr, MemoryAccess::READ, V, V->getType(), true, V,
- ArrayRef<const SCEV *>(), ArrayRef<const SCEV *>(),
- ScopArrayInfo::MK_Value);
+ ArrayRef<const SCEV *>(), ArrayRef<const SCEV *>(), Kind);
if (ValueInst)
ensureValueWrite(ValueInst);
}
diff --git a/polly/test/ScopInfo/exit-phi-1.ll b/polly/test/ScopInfo/exit-phi-1.ll
new file mode 100644
index 00000000000..27a83340b39
--- /dev/null
+++ b/polly/test/ScopInfo/exit-phi-1.ll
@@ -0,0 +1,39 @@
+; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s
+; RUN: opt %loadPolly -polly-codegen -disable-output < %s
+;
+; Verify we only create one SAI object for up.3.ph as it is outside the SCoP.
+;
+; CHECK: Region: %for.body
+;
+; CHECK: Arrays {
+; CHECK-NEXT: i32* MemRef_A[*]; // Element size 8
+; CHECK-NEXT: double MemRef_up_3_ph; // Element size 8
+; CHECK-NEXT: }
+;
+; ModuleID = 'bugpoint-reduced-simplified.bc'
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+
+; Function Attrs: uwtable
+define void @_ZN6soplex14SPxAggregateSM9eliminateERKNS_7SVectorEd(i32** nocapture readonly %A) {
+entry:
+ br label %for.cond.outer304
+
+for.cond.outer304: ; preds = %if.else113, %if.then111, %entry
+ %up.3.ph = phi double [ 0.000000e+00, %entry ], [ undef, %if.else113 ], [ undef, %if.then111 ]
+ br i1 undef, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond.outer304
+ %0 = load i32*, i32** %A, align 8
+ %add = fadd double %up.3.ph, undef
+ %val.i.i.i235 = getelementptr inbounds i32, i32* %0, i64 0
+ br i1 false, label %if.else113, label %if.then111
+
+if.then111: ; preds = %for.body
+ br label %for.cond.outer304
+
+if.else113: ; preds = %for.body
+ br label %for.cond.outer304
+
+for.end: ; preds = %for.cond.outer304
+ ret void
+}
OpenPOWER on IntegriCloud