[polly] r219499 - Use the new access function (if present) to compute the access stride.

Johannes Doerfert doerfert at cs.uni-saarland.de
Fri Oct 10 07:28:46 PDT 2014


Author: jdoerfert
Date: Fri Oct 10 09:28:46 2014
New Revision: 219499

URL: http://llvm.org/viewvc/llvm-project?rev=219499&view=rev
Log:
Use the new access function (if present) to compute the access stride.

Differential Revision: http://reviews.llvm.org/D5661

Added:
    polly/trunk/test/Isl/CodeGen/MemAccess/simple_stride_test.ll
Modified:
    polly/trunk/lib/Analysis/ScopInfo.cpp

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=219499&r1=219498&r2=219499&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Fri Oct 10 09:28:46 2014
@@ -618,7 +618,9 @@ static isl_map *getEqualAndLarger(isl_sp
 
 isl_set *MemoryAccess::getStride(__isl_take const isl_map *Schedule) const {
   isl_map *S = const_cast<isl_map *>(Schedule);
-  isl_map *AccessRelation = getAccessRelation();
+  isl_map *AccessRelation = getNewAccessRelation();
+  if (!AccessRelation)
+    AccessRelation = getAccessRelation();
   isl_space *Space = isl_space_range(isl_map_get_space(S));
   isl_map *NextScatt = getEqualAndLarger(Space);
 

Added: polly/trunk/test/Isl/CodeGen/MemAccess/simple_stride_test.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/CodeGen/MemAccess/simple_stride_test.ll?rev=219499&view=auto
==============================================================================
--- polly/trunk/test/Isl/CodeGen/MemAccess/simple_stride_test.ll (added)
+++ polly/trunk/test/Isl/CodeGen/MemAccess/simple_stride_test.ll Fri Oct 10 09:28:46 2014
@@ -0,0 +1,47 @@
+; RUN: opt %loadPolly -basicaa -polly-import-jscop -polly-import-jscop-dir=%S -polly-codegen-isl -polly-vectorizer=polly -S < %s | FileCheck %s
+;
+; Check that we use the correct __new__ strides:
+;    stride zero for B
+;    stride one for A
+;
+; CHECK:  %polly.access.B = getelementptr i32* %B, i64 0
+; CHECK:  %[[BC:[._a-zA-Z0-9]*]] = bitcast i32* %polly.access.B to <1 x i32>*
+; CHECK:  %[[LD:[._a-zA-Z0-9]*]] = load <1 x i32>* %[[BC]], align 8
+; CHECK:  %[[SV:[._a-zA-Z0-9]*]] = shufflevector <1 x i32> %[[LD]], <1 x i32> %[[LD]], <16 x i32> zeroinitializer
+;
+; CHECK:  %polly.access.A = getelementptr i32* %A, i64 0
+; CHECK:  %[[VP:[._a-zA-Z0-9]*]] = bitcast i32* %polly.access.A to <16 x i32>*
+; CHECK:  store <16 x i32> %[[SV]], <16 x i32>* %[[VP]], align 8
+;
+;    void simple_stride(int *restrict A, int *restrict B) {
+;      for (int i = 0; i < 16; i++)
+;        A[i * 2] = B[i * 2];
+;    }
+;
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+
+define void @simple_stride(i32* noalias %A, i32* noalias %B) {
+entry:
+  br label %for.cond
+
+for.cond:                                         ; preds = %for.inc, %entry
+  %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
+  %exitcond = icmp ne i64 %indvars.iv, 16
+  br i1 %exitcond, label %for.body, label %for.end
+
+for.body:                                         ; preds = %for.cond
+  %tmp = shl nsw i64 %indvars.iv, 1
+  %arrayidx = getelementptr inbounds i32* %B, i64 %tmp
+  %tmp4 = load i32* %arrayidx, align 4
+  %tmp5 = shl nsw i64 %indvars.iv, 1
+  %arrayidx3 = getelementptr inbounds i32* %A, i64 %tmp5
+  store i32 %tmp4, i32* %arrayidx3, align 4
+  br label %for.inc
+
+for.inc:                                          ; preds = %for.body
+  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
+  br label %for.cond
+
+for.end:                                          ; preds = %for.cond
+  ret void
+}





More information about the llvm-commits mailing list