[polly] r228866 - [FIX] Correctly handle scalar dependences of branch instructions

Johannes Doerfert doerfert at cs.uni-saarland.de
Wed Feb 11 11:12:19 PST 2015


Author: jdoerfert
Date: Wed Feb 11 13:12:19 2015
New Revision: 228866

URL: http://llvm.org/viewvc/llvm-project?rev=228866&view=rev
Log:
[FIX] Correctly handle scalar dependences of branch instructions


Modified:
    polly/trunk/lib/Support/ScopHelper.cpp
    polly/trunk/test/ScopInfo/scalar_dependence_cond_br.ll

Modified: polly/trunk/lib/Support/ScopHelper.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/ScopHelper.cpp?rev=228866&r1=228865&r2=228866&view=diff
==============================================================================
--- polly/trunk/lib/Support/ScopHelper.cpp (original)
+++ polly/trunk/lib/Support/ScopHelper.cpp Wed Feb 11 13:12:19 2015
@@ -70,6 +70,8 @@ Value *polly::getPointerOperand(Instruct
 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();
 }
 

Modified: polly/trunk/test/ScopInfo/scalar_dependence_cond_br.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/scalar_dependence_cond_br.ll?rev=228866&r1=228865&r2=228866&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/scalar_dependence_cond_br.ll (original)
+++ polly/trunk/test/ScopInfo/scalar_dependence_cond_br.ll Wed Feb 11 13:12:19 2015
@@ -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) {





More information about the llvm-commits mailing list