llvm-project/polly/test/Isl/CodeGen/MemAccess/simple_analyze.ll

77 lines
4.2 KiB
LLVM
Raw Normal View History

;RUN: opt %loadPolly -polly-detect-unprofitable -polly-import-jscop -analyze -polly-import-jscop-dir=%S -polly-import-jscop-postfix=transformed < %s | FileCheck %s
;RUN: opt %loadPolly -polly-detect-unprofitable -polly-import-jscop -polly-import-jscop-dir=%S -polly-import-jscop-postfix=transformed -polly-codegen-isl -polly-vectorizer=polly -S < %s | FileCheck %s --check-prefix=JSCOPVEC
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32"
@A = common global [100 x i32] zeroinitializer, align 4
@B = common global [100 x i32] zeroinitializer, align 4
define i32 @simple() nounwind {
entry:
br label %for.cond
for.cond: ; preds = %for.inc, %entry
%0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
%arrayidx = getelementptr [100 x i32]* @A, i32 0, i32 %0
%exitcond1 = icmp ne i32 %0, 12
br i1 %exitcond1, label %for.body, label %for.end
for.body: ; preds = %for.cond
store i32 %0, i32* %arrayidx
br label %for.inc
for.inc: ; preds = %for.body
%inc = add nsw i32 %0, 1
br label %for.cond
for.end: ; preds = %for.cond
Switch default code generation backend to isl The isl based backend has been tested since a long time and with the recently commited OpenMP support the last missing piece of functionality was ported from the CLooG backend. The isl based backend gives us interesting new functionality: - Run-time alias checks (enabled by default) Optimize scops that contain possibly aliasing pointers. This feature has largely increased the number of loop nests we consider for optimization. Thanks Johannes! - Delinearization (not yet enabled by default) Model accesses to multi-dimensional arrays precisely. This will allow us to understand kernels with multi-dimensional VLAs written in Julia, boost::ublas, coremark or C99. Thanks Sebastian! - Generation of higher quality code Sven and me spent a long time to optimize the quality of the generated code. A major focus were expressions as they result from modulos/divisions or piecewise affine expressions (a ? b : c). - Full/Partial tile separation, polyhedral unrolling The isl code generation provides functionality to generate specialized code for core and cleanup loops and to specialize code using polyhedral context information while unrolling statements. (not yet exploited in Polly) - Modifieable access functions We can now use standard isl functionality to remap memory accesses to new data locations. A standard use case is the use of shared memory, where accesses to a larger region in global memory need to be mapped to a smaller shared memory region using a modulo mapping. (not yet exploited in Polly) The cloog based code generation is still available for comparision, but is scheduled for removal. llvm-svn: 222101
2014-11-17 01:02:11 +08:00
fence seq_cst
br label %for.cond4
for.cond4: ; preds = %for.inc11, %for.end
%1 = phi i32 [ 0, %for.end ], [ %inc13, %for.inc11 ]
%arrayidx10 = getelementptr [100 x i32]* @B, i32 0, i32 %1
%exitcond = icmp ne i32 %1, 12
br i1 %exitcond, label %for.body7, label %for.end14
for.body7: ; preds = %for.cond4
store i32 %1, i32* %arrayidx10
br label %for.inc11
for.inc11: ; preds = %for.body7
%inc13 = add nsw i32 %1, 1
br label %for.cond4
for.end14: ; preds = %for.cond4
ret i32 0
}
; CHECK-DAG: New access function '{ Stmt_for_body7[i0] -> MemRef_B[0] }'detected in JSCOP file
; CHECK-DAG: New access function '{ Stmt_for_body[i0] -> MemRef_A[0] }'detected in JSCOP file
; Verify that the new access function (see above) is actually used during vector code generation.
; JSCOPVEC: store i32 0, i32* getelementptr inbounds ([100 x i32]* @B, i32 0, i32 0)
; JSCOPVEC: store i32 1, i32* getelementptr inbounds ([100 x i32]* @B, i32 0, i32 0)
; JSCOPVEC: store i32 2, i32* getelementptr inbounds ([100 x i32]* @B, i32 0, i32 0)
; JSCOPVEC: store i32 3, i32* getelementptr inbounds ([100 x i32]* @B, i32 0, i32 0)
; JSCOPVEC: store i32 4, i32* getelementptr inbounds ([100 x i32]* @B, i32 0, i32 0)
; JSCOPVEC: store i32 5, i32* getelementptr inbounds ([100 x i32]* @B, i32 0, i32 0)
; JSCOPVEC: store i32 6, i32* getelementptr inbounds ([100 x i32]* @B, i32 0, i32 0)
; JSCOPVEC: store i32 7, i32* getelementptr inbounds ([100 x i32]* @B, i32 0, i32 0)
; JSCOPVEC: store i32 8, i32* getelementptr inbounds ([100 x i32]* @B, i32 0, i32 0)
; JSCOPVEC: store i32 9, i32* getelementptr inbounds ([100 x i32]* @B, i32 0, i32 0)
; JSCOPVEC: store i32 10, i32* getelementptr inbounds ([100 x i32]* @B, i32 0, i32 0)
; JSCOPVEC: store i32 11, i32* getelementptr inbounds ([100 x i32]* @B, i32 0, i32 0)
; JSCOPVEC: store i32 0, i32* getelementptr inbounds ([100 x i32]* @A, i32 0, i32 0)
; JSCOPVEC: store i32 1, i32* getelementptr inbounds ([100 x i32]* @A, i32 0, i32 0)
; JSCOPVEC: store i32 2, i32* getelementptr inbounds ([100 x i32]* @A, i32 0, i32 0)
; JSCOPVEC: store i32 3, i32* getelementptr inbounds ([100 x i32]* @A, i32 0, i32 0)
; JSCOPVEC: store i32 4, i32* getelementptr inbounds ([100 x i32]* @A, i32 0, i32 0)
; JSCOPVEC: store i32 5, i32* getelementptr inbounds ([100 x i32]* @A, i32 0, i32 0)
; JSCOPVEC: store i32 6, i32* getelementptr inbounds ([100 x i32]* @A, i32 0, i32 0)
; JSCOPVEC: store i32 7, i32* getelementptr inbounds ([100 x i32]* @A, i32 0, i32 0)
; JSCOPVEC: store i32 8, i32* getelementptr inbounds ([100 x i32]* @A, i32 0, i32 0)
; JSCOPVEC: store i32 9, i32* getelementptr inbounds ([100 x i32]* @A, i32 0, i32 0)
; JSCOPVEC: store i32 10, i32* getelementptr inbounds ([100 x i32]* @A, i32 0, i32 0)
; JSCOPVEC: store i32 11, i32* getelementptr inbounds ([100 x i32]* @A, i32 0, i32 0)