summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Doerfert <doerfert@cs.uni-saarland.de>2015-02-11 19:12:19 +0000
committerJohannes Doerfert <doerfert@cs.uni-saarland.de>2015-02-11 19:12:19 +0000
commitc47edb51c68b399b1576b7306bad1b8cb7e39c28 (patch)
treef76c5c037e6d6dab99cae426d2894bdb2b300d7d
parentd594aeb248be95aa4765e435c28a066e5f861ac4 (diff)
downloadbcm5719-llvm-c47edb51c68b399b1576b7306bad1b8cb7e39c28.tar.gz
bcm5719-llvm-c47edb51c68b399b1576b7306bad1b8cb7e39c28.zip
[FIX] Correctly handle scalar dependences of branch instructions
llvm-svn: 228866
-rw-r--r--polly/lib/Support/ScopHelper.cpp2
-rw-r--r--polly/test/ScopInfo/scalar_dependence_cond_br.ll9
2 files changed, 9 insertions, 2 deletions
diff --git a/polly/lib/Support/ScopHelper.cpp b/polly/lib/Support/ScopHelper.cpp
index 52e673357ae..39a6040d50c 100644
--- a/polly/lib/Support/ScopHelper.cpp
+++ b/polly/lib/Support/ScopHelper.cpp
@@ -70,6 +70,8 @@ Value *polly::getPointerOperand(Instruction &Inst) {
Type *polly::getAccessInstType(Instruction *AccInst) {
if (StoreInst *Store = dyn_cast<StoreInst>(AccInst))
return Store->getValueOperand()->getType();
+ if (BranchInst *Branch = dyn_cast<BranchInst>(AccInst))
+ return Branch->getCondition()->getType();
return AccInst->getType();
}
diff --git a/polly/test/ScopInfo/scalar_dependence_cond_br.ll b/polly/test/ScopInfo/scalar_dependence_cond_br.ll
index f9d1cfa7fb8..a89b105c290 100644
--- a/polly/test/ScopInfo/scalar_dependence_cond_br.ll
+++ b/polly/test/ScopInfo/scalar_dependence_cond_br.ll
@@ -1,14 +1,19 @@
; RUN: opt %loadPolly -polly-scops -disable-polly-intra-scop-scalar-to-array -polly-model-phi-nodes -analyze < %s | FileCheck %s
; XFAIL: *
;
-; CHECK: Statements
-;
; void f(int *A, int c, int d) {
; for (int i = 0; i < 1024; i++)
; if (c < i)
; A[i]++;
; }
;
+; CHECK: Stmt_for_cond
+; CHECK: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
+; CHECK: [c] -> { Stmt_for_cond[i0] -> MemRef_cmp1[] };
+; CHECK: Stmt_for_body
+; CHECK: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
+; CHECK: [c] -> { Stmt_for_body[i0] -> MemRef_cmp1[] };
+;
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
define void @f(i32* %A, i64 %c) {
OpenPOWER on IntegriCloud