[FIX] Correctly handle scalar dependences of branch instructions
authorJohannes Doerfert <doerfert@cs.uni-saarland.de>
Wed, 11 Feb 2015 19:12:19 +0000 (19:12 +0000)
committerJohannes Doerfert <doerfert@cs.uni-saarland.de>
Wed, 11 Feb 2015 19:12:19 +0000 (19:12 +0000)
llvm-svn: 228866

polly/lib/Support/ScopHelper.cpp
polly/test/ScopInfo/scalar_dependence_cond_br.ll

index 52e6733..39a6040 100644 (file)
@@ -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();
 }
 
index f9d1cfa..a89b105 100644 (file)
@@ -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) {