[PATCH] D35430: DA: remove uses of GEP, only ask SCEV

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 3 10:48:54 PDT 2018


fhahn added a comment.

With this change, we cannot proof dependences in cases the loop bounds are not known, e.g.

  target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
  target triple = "x86_64-unknown-linux-gnu"
  
  @A = common global [100 x [100 x i64]] zeroinitializer
  
  ;;  for(int i=0;i<100;i++)
  ;;    for(int j=0;j<100;j++)
  ;;      A[j][i] = A[j][i]+k;
  
  define void @interchange_01(i64 %k, i64 %N) {
  entry:
    br label %for1.header
  
  for1.header:
    %j23 = phi i64 [ 0, %entry ], [ %j.next24, %for1.inc10 ]
    br label %for2
  
  for2:
    %j = phi i64 [ %j.next, %for2 ], [ 0, %for1.header ]
    %arrayidx5 = getelementptr inbounds [100 x [100 x i64]], [100 x [100 x i64]]* @A, i64 0, i64 %j, i64 %j23
    %arrayidx6 = getelementptr inbounds [100 x [100 x i64]], [100 x [100 x i64]]* @A, i64 0, i64 %j, i64 %j23
    %lv = load i64, i64* %arrayidx5
    %add = add nsw i64 %lv, %k
    store i64 %add, i64* %arrayidx6
    %j.next = add nuw nsw i64 %j, 1
    %exitcond = icmp eq i64 %j, %N
    br i1 %exitcond, label %for1.inc10, label %for2
  
  for1.inc10:
    %j.next24 = add nuw nsw i64 %j23, 1
    %exitcond26 = icmp eq i64 %j23, %N
    br i1 %exitcond26, label %for.end12, label %for1.header
  
  for.end12:
    ret void
  }

I am probably missing something, but couldn't we just calculate `DstSCEV - SrcSCEV` using scalar evolution. If it is a zero, wouldn't that show that there is an EQ dependence in that case? And wouldn't the sign of a non zero constant indicate the direction?


Repository:
  rL LLVM

https://reviews.llvm.org/D35430





More information about the llvm-commits mailing list