Make use of scalar/phi code generation explicit in the tests

This ensures we pass all tests independently of how we set the options
-disable-polly-intra-scop-scalar-to-array and -polly-model-phi-nodes.

(At least if we enable both or disable both. Enabling them individually makes
 little sense, as they will hopefully disappear soon anyhow).

llvm-svn: 238087
This commit is contained in:
Tobias Grosser 2015-05-23 03:34:35 +00:00
parent e0d60ba876
commit 268205939f
14 changed files with 135 additions and 45 deletions

View File

@ -1,5 +1,5 @@
; RUN: opt %loadPolly -polly-detect-unprofitable -polly-prepare -S < %s | FileCheck %s
; RUN: opt %loadPolly -polly-detect-unprofitable -polly-prepare -S < %s | FileCheck %s
; RUN: opt %loadPolly -polly-detect-unprofitable -polly-prepare -S -polly-model-phi-nodes=true < %s | FileCheck %s -check-prefix=PHI
; RUN: opt %loadPolly -polly-detect-unprofitable -polly-prepare -S -polly-model-phi-nodes=false < %s | FileCheck %s
; void f(long A[], long N) {
; long i;
@ -7,6 +7,8 @@
; A[i] = i;
; }
; PHI-NOT: alloca
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
define void @f(i64* %A, i64 %N) nounwind {

View File

@ -1,6 +1,7 @@
; RUN: opt %loadPolly -polly-detect-unprofitable -S -polly-prepare < %s | FileCheck %s
; ModuleID = 'multiple_loops_trivial_phis.ll'
;
; RUN: opt %loadPolly -polly-detect-unprofitable -S -polly-prepare -polly-model-phi-nodes=true < %s | FileCheck %s -check-prefix=PHI
; RUN: opt %loadPolly -polly-detect-unprofitable -S -polly-prepare -polly-model-phi-nodes=false < %s | FileCheck %s
; int f(int * __restrict__ A) {
; int i, j, sum = 0;
; for (i = 0; i < 100; i++) {
@ -22,8 +23,7 @@ entry:
for.body: ; preds = %entry, %for.inc5
%sum.04 = phi i32 [ 0, %entry ], [ %add4.lcssa, %for.inc5 ]
%indvars.iv23 = phi i64 [ 0, %entry ], [ %2, %for.inc5 ]
%mul = shl nsw i32 %sum.04, 1
br label %for.inc
%mul = shl nsw i32 %sum.04, 1 br label %for.inc
for.inc: ; preds = %for.body, %for.inc
%sum.12 = phi i32 [ %mul, %for.body ], [ %add4, %for.inc ]
@ -53,3 +53,5 @@ attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointe
; CHECK: alloca
; CHECK: alloca
; CHECK-NOT: alloca
; PHI-NOT: alloca

View File

@ -1,17 +1,17 @@
; RUN: opt %loadPolly -polly-detect-unprofitable -S -polly-prepare < %s | FileCheck %s
; ModuleID = 'single_loop_trivial_phi.ll'
;
; RUN: opt %loadPolly -polly-detect-unprofitable -S -polly-prepare -polly-model-phi-nodes=true < %s | FileCheck %s -check-prefix=PHI
; RUN: opt %loadPolly -polly-detect-unprofitable -S -polly-prepare -polly-model-phi-nodes=false < %s | FileCheck %s
; int f(int *A, int N) {
; int i, sum = 0;
; for (i = 0; i < N; i++)
; sum += A[i];
; return sum;
; }
; ModuleID = 'stack-slots.ll'
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
; Function Attrs: nounwind uwtable
define i32 @f(i32* %A, i32 %N) #0 {
define i32 @f(i32* %A, i32 %N) {
entry:
%cmp1 = icmp sgt i32 %N, 0
br i1 %cmp1, label %for.inc.lr.ph, label %for.end
@ -39,11 +39,12 @@ for.end: ; preds = %for.cond.for.end_cr
ret i32 %sum.0.lcssa
}
attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
; Verify that only two allocas are created.
; Both are needed for the %sum.0 PHI node and none should be created for the
; %sum.0.lcssa PHI node
; CHECK: alloca
; CHECK: alloca
; CHECK-NOT: alloca
; PHI-NOT: alloca

View File

@ -1,7 +1,7 @@
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-independent -S < %s | FileCheck %s
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-independent -S < %s | FileCheck %s
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-independent -disable-polly-intra-scop-scalar-to-array -S < %s | FileCheck %s -check-prefix=SCALARACCESS
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-independent -disable-polly-intra-scop-scalar-to-array -S < %s | FileCheck %s -check-prefix=SCALARACCESS
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-independent -disable-polly-intra-scop-scalar-to-array=false -S < %s | FileCheck %s
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-independent -disable-polly-intra-scop-scalar-to-array=false -S < %s | FileCheck %s
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-independent -disable-polly-intra-scop-scalar-to-array=true -S < %s | FileCheck %s -check-prefix=SCALARACCESS
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-independent -disable-polly-intra-scop-scalar-to-array=true -S < %s | FileCheck %s -check-prefix=SCALARACCESS
; void f(long A[], int N, int *init_ptr) {
; long i, j;

View File

@ -1,7 +1,7 @@
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-independent -S < %s | FileCheck %s
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-independent -S < %s | FileCheck %s
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-independent -disable-polly-intra-scop-scalar-to-array -S < %s | FileCheck %s -check-prefix=SCALARACCESS
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-independent -disable-polly-intra-scop-scalar-to-array -S < %s | FileCheck %s -check-prefix=SCALARACCESS
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-independent -disable-polly-intra-scop-scalar-to-array=false -S < %s | FileCheck %s
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-independent -disable-polly-intra-scop-scalar-to-array=false -S < %s | FileCheck %s
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-independent -disable-polly-intra-scop-scalar-to-array=true -S < %s | FileCheck %s -check-prefix=SCALARACCESS
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-independent -disable-polly-intra-scop-scalar-to-array=true -S < %s | FileCheck %s -check-prefix=SCALARACCESS
; void f(long A[], int N, int *init_ptr) {
; long i, j;

View File

@ -1,5 +1,5 @@
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-independent -S < %s | FileCheck %s
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-independent -S < %s | FileCheck %s
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-independent -disable-polly-intra-scop-scalar-to-array=false -polly-model-phi-nodes=false -S < %s | FileCheck %s
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-independent -disable-polly-intra-scop-scalar-to-array=true -polly-model-phi-nodes=true -S < %s | FileCheck %s -check-prefix=SCALAR
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
define void @phi_nodes_outside() {
@ -33,3 +33,11 @@ cleanup:
; CHECK: for.i.2:
; CHECK: %i.2 = phi i32 [ %i.2.next, %for.i.2 ], [ %i.1.next.loadoutside, %for.i.2.preheader ]
; SCALAR-NOT: alloca
; SCALAR: for.i.2.preheader:
; SCALAR-NOT: load
; SCALAR: for.i.2:
; SCALAR: %i.2 = phi i32 [ %i.2.next, %for.i.2 ], [ %i.1.next, %for.i.2.preheader ]

View File

@ -1,7 +1,7 @@
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-independent < %s -S | FileCheck %s
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-independent < %s -S | FileCheck %s
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-independent -disable-polly-intra-scop-scalar-to-array -S < %s | FileCheck %s -check-prefix=SCALARACCESS
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-independent -disable-polly-intra-scop-scalar-to-array < %s -S | FileCheck %s -check-prefix=SCALARACCESS
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-independent -disable-polly-intra-scop-scalar-to-array=false -polly-model-phi-nodes=false < %s -S | FileCheck %s
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-independent -disable-polly-intra-scop-scalar-to-array=false -polly-model-phi-nodes=false < %s -S | FileCheck %s
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-independent -disable-polly-intra-scop-scalar-to-array=true -polly-model-phi-nodes=true -S < %s | FileCheck %s -check-prefix=SCALARACCESS
; RAUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-independent -disable-polly-intra-scop-scalar-to-array=true -polly-model-phi-nodes=true < %s -S | FileCheck %s -check-prefix=SCALARACCESS
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
@ -136,9 +136,7 @@ return:
; It is not possible to have a scop which accesses a scalar element that is
; a global variable. All global variables are pointers containing possibly
; a single element. Hence they do not need to be handled anyways.
; Please note that this is still required when scalar to array rewritting is
; disabled.
; a single element.
; CHECK: @use_after_scop()
define i32 @use_after_scop() nounwind {
@ -150,7 +148,7 @@ entry:
; CHECK: fence
; SCALARACCESS: entry:
; SCALARACCESS: %scalar.s2a = alloca float
; SCALARACCESS-NOT: alloca
; SCALARACCESS: fence
for.head:
@ -168,7 +166,7 @@ for.body:
; SCALARACCESS: for.body:
; SCALARACCESS: %scalar = load float, float* %arrayidx
; SCALARACCESS: store float %scalar, float* %scalar.s2a
; SCALARACCESS-NOT: store float %scalar
for.inc:
%indvar.next = add i64 %indvar, 1
@ -186,9 +184,8 @@ for.after:
; CHECK: %return_value = fptosi float %scalar.loadoutside to i32
; SCALARACCESS: for.after:
; SCALARACCESS: %scalar.loadoutside = load float, float* %scalar.s2a
; SCALARACCESS: fence seq_cst
; SCALARACCESS: %return_value = fptosi float %scalar.loadoutside to i32
; SCALARACCESS: %return_value = fptosi float %scalar to i32
return:
ret i32 %return_value

View File

@ -1,4 +1,5 @@
; RUN: opt %loadPolly -polly-detect-unprofitable -polly-ast -analyze -S < %s | FileCheck %s
; RUN: opt %loadPolly -polly-detect-unprofitable -polly-ast -analyze -disable-polly-intra-scop-scalar-to-array=false -polly-model-phi-nodes=false -S < %s | FileCheck %s
; RUN: opt %loadPolly -polly-detect-unprofitable -polly-ast -analyze -disable-polly-intra-scop-scalar-to-array=true -polly-model-phi-nodes=true -S < %s | FileCheck %s -check-prefix=SCALAR
;#define N 20
;
@ -66,3 +67,6 @@ return: ; preds = %if.else, %if.then
; CHECK: for region: 'for.cond => for.end.region' in function 'main':
; CHECK-NOT: Stmt_for_body(0);
; SCALAR: for region: 'for.cond => for.end' in function 'main':
; SCALAR-NOT: Stmt_for_body(0);

View File

@ -1,5 +1,8 @@
; RUN: opt %loadPolly -polly-detect-unprofitable -polly-no-early-exit -polly-ast -analyze -polly-ignore-aliasing < %s | FileCheck %s
; RUN: opt %loadPolly -polly-detect-unprofitable -polly-no-early-exit -polly-codegen -polly-ignore-aliasing < %s
; RUN: opt %loadPolly -polly-detect-unprofitable -polly-no-early-exit -polly-ast -analyze -polly-ignore-aliasing -disable-polly-intra-scop-scalar-to-array=false -polly-model-phi-nodes=false < %s | FileCheck %s
; RUN: opt %loadPolly -polly-detect-unprofitable -polly-no-early-exit -polly-codegen -polly-ignore-aliasing -disable-polly-intra-scop-scalar-to-array=false -polly-model-phi-nodes=false -disable-output < %s
; RUN: opt %loadPolly -polly-detect-unprofitable -polly-no-early-exit -polly-ast -analyze -polly-ignore-aliasing -disable-polly-intra-scop-scalar-to-array=true -polly-model-phi-nodes=true < %s | FileCheck %s -check-prefix=SCALAR
; RUN: opt %loadPolly -polly-detect-unprofitable -polly-no-early-exit -polly-codegen -polly-ignore-aliasing -disable-polly-intra-scop-scalar-to-array=true -polly-model-phi-nodes=true -disable-output < %s
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
; CHECK: if (1)
@ -13,6 +16,17 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
; CHECK: if (1)
; CHECK: Stmt_for_0(0);
; SCALAR: if (1)
; SCALAR: {
; SCALAR: for (int c0 = 0; c0 <= -Scalar0.val + 99; c0 += 1)
; SCALAR: Stmt_for_1(c0);
; SCALAR: if (Scalar0.val >= 100)
; SCALAR: Stmt_for_1(0);
; SCALAR: }
; SCALAR: if (1)
; SCALAR: Stmt_for_0(0);
define void @foo(i32* %A) {
entry:

View File

@ -1,4 +1,5 @@
; RUN: opt %loadPolly -polly-detect-unprofitable -polly-detect -analyze < %s | FileCheck %s -check-prefix=CHECK
; RUN: opt %loadPolly -polly-detect-unprofitable -polly-detect -polly-model-phi-nodes=true -disable-polly-intra-scop-scalar-to-array=true -analyze < %s | FileCheck %s -check-prefix=PHI
; RUN: opt %loadPolly -polly-detect-unprofitable -polly-detect -polly-model-phi-nodes=false -disable-polly-intra-scop-scalar-to-array=false -analyze < %s | FileCheck %s -check-prefix=CHECK
; void f(long A[], long N) {
; long i;
@ -39,4 +40,5 @@ return:
ret void
}
; PHI: Valid Region for Scop: pre => return
; CHECK: Valid Region for Scop: for.i => then

View File

@ -1,4 +1,5 @@
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-detect -analyze < %s | FileCheck %s
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-detect -polly-model-phi-nodes=true -disable-polly-intra-scop-scalar-to-array=true -analyze < %s | FileCheck %s -check-prefix=PHI
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-detect -polly-model-phi-nodes=false -disable-polly-intra-scop-scalar-to-array=false -analyze < %s | FileCheck %s
; void f(long A[], long N, long *init_ptr) {
; long i, j;
@ -47,4 +48,5 @@ return:
ret void
}
; PHI: Valid Region for Scop: for.i => return
; CHECK: Valid Region for Scop: for.j => for.i.end

View File

@ -1,4 +1,5 @@
; RUN: opt %loadPolly -basicaa -polly-scops -polly-allow-nonaffine -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops=true -analyze < %s | FileCheck %s
; RUN: opt %loadPolly -basicaa -polly-scops -polly-allow-nonaffine -polly-allow-nonaffine-branches -disable-polly-intra-scop-scalar-to-array=false -polly-allow-nonaffine-loops=true -analyze < %s | FileCheck %s
; RUN: opt %loadPolly -basicaa -polly-scops -polly-allow-nonaffine -polly-allow-nonaffine-branches -disable-polly-intra-scop-scalar-to-array=true -polly-allow-nonaffine-loops=true -analyze < %s | FileCheck %s -check-prefix=SCALAR
;
; CHECK: Function: f
; CHECK: Region: %bb1---%bb13
@ -26,6 +27,30 @@
; CHECK: MayWriteAccess := [Reduction Type: +] [Scalar: 0]
; CHECK: { Stmt_(bb3 => bb11)[i0] -> MemRef_A[o0] : o0 <= 2147483645 and o0 >= -2147483648 };
; CHECK: }
; SCALAR: Function: f
; SCALAR: Region: %bb1---%bb13
; SCALAR: Max Loop Depth: 1
; SCALAR: Context:
; SCALAR: { : }
; SCALAR: Assumed Context:
; SCALAR: { : }
; SCALAR: Alias Groups (0):
; SCALAR: n/a
; SCALAR: Statements {
; SCALAR: Stmt_(bb3 => bb11)
; SCALAR: Domain :=
; SCALAR: { Stmt_(bb3 => bb11)[i0] : i0 >= 0 and i0 <= 1023 };
; SCALAR: Schedule :=
; SCALAR: { Stmt_(bb3 => bb11)[i0] -> [i0] };
; SCALAR: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
; SCALAR: { Stmt_(bb3 => bb11)[i0] -> MemRef_C[i0] };
; SCALAR: ReadAccess := [Reduction Type: +] [Scalar: 0]
; SCALAR: { Stmt_(bb3 => bb11)[i0] -> MemRef_A[o0] : o0 <= 2147483645 and o0 >= -2147483648 };
; SCALAR: MayWriteAccess := [Reduction Type: +] [Scalar: 0]
; SCALAR: { Stmt_(bb3 => bb11)[i0] -> MemRef_A[o0] : o0 <= 2147483645 and o0 >= -2147483648 };
; SCALAR: }
;
; void f(int * restrict A, int * restrict C) {
; int j;

View File

@ -1,4 +1,5 @@
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-prepare -polly-scops -analyze < %s | FileCheck %s
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-prepare -polly-scops -analyze -polly-model-phi-nodes=false -disable-polly-intra-scop-scalar-to-array=false < %s | FileCheck %s
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-prepare -polly-scops -analyze -polly-model-phi-nodes=true -disable-polly-intra-scop-scalar-to-array=true < %s | FileCheck %s -check-prefix=SCALAR
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
@ -78,3 +79,35 @@ bb2: ; preds = %bb, %entry
; CHECK: [n] -> { Stmt_bb[i0] -> MemRef_k_05_reg2mem[0] };
; CHECK: MustWriteAccess :=
; CHECK: [n] -> { Stmt_bb[i0] -> MemRef__reg2mem[0] };
; SCALAR: Stmt_bb_nph
; SCALAR: Domain :=
; SCALAR: [n] -> { Stmt_bb_nph[] : n >= 2 };
; SCALAR: Schedule :=
; SCALAR: [n] -> { Stmt_bb_nph[] -> [0, 0] };
; SCALAR: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
; SCALAR: [n] -> { Stmt_bb_nph[] -> MemRef_a[0] };
; SCALAR: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
; SCALAR: [n] -> { Stmt_bb_nph[] -> MemRef_1[] };
; SCALAR: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
; SCALAR: [n] -> { Stmt_bb_nph[] -> MemRef_k_05[] };
; SCALAR: Stmt_bb
; SCALAR: Domain :=
; SCALAR: [n] -> { Stmt_bb[i0] : i0 >= 0 and i0 <= -2 + n and n >= 2 };
; SCALAR: Schedule :=
; SCALAR: [n] -> { Stmt_bb[i0] -> [1, i0] };
; SCALAR: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
; SCALAR: [n] -> { Stmt_bb[i0] -> MemRef_1[] };
; SCALAR: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
; SCALAR: [n] -> { Stmt_bb[i0] -> MemRef_k_05[] };
; SCALAR: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
; SCALAR: [n] -> { Stmt_bb[i0] -> MemRef_1[] };
; SCALAR: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
; SCALAR: [n] -> { Stmt_bb[i0] -> MemRef_k_05[] };
; SCALAR: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
; SCALAR: [n] -> { Stmt_bb[i0] -> MemRef_a[1 + i0] };
; SCALAR: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
; SCALAR: [n] -> { Stmt_bb[i0] -> MemRef_a[2 + 2i0] };
; SCALAR: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
; SCALAR: [n] -> { Stmt_bb[i0] -> MemRef_a[4 + i0] };

View File

@ -1,5 +1,5 @@
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-analyze-ir -analyze < %s | FileCheck %s
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-analyze-ir -analyze -disable-polly-intra-scop-scalar-to-array < %s | FileCheck %s -check-prefix=SCALARACCESS
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-analyze-ir -analyze -disable-polly-intra-scop-scalar-to-array=false < %s | FileCheck %s
; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-analyze-ir -analyze -disable-polly-intra-scop-scalar-to-array=true < %s | FileCheck %s -check-prefix=SCALARACCESS
; void f(long A[], int N, int *init_ptr) {
; long i, j;