1 ; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-parallel -polly-parallel-force -polly-ast -analyze < %s | FileCheck %s -check-prefix=AST
2 ; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-parallel -polly-parallel-force -polly-codegen-isl -S -verify-dom-info < %s | FileCheck %s -check-prefix=IR
3 ; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-parallel -polly-parallel-force -polly-codegen-isl -S -verify-dom-info < %s | FileCheck %s -check-prefix=IR
5 ; The interesting part of this test case is the instruction:
6 ; %tmp = bitcast i8* %call to i64**
7 ; which is not part of the scop. In the SCEV based code generation not '%tmp',
8 ; but %call is a parameter of the SCoP and we need to make sure its value is
9 ; properly forwarded to the subfunction.
11 ; AST: #pragma omp parallel for
12 ; AST: for (int c0 = 0; c0 < cols; c0 += 1)
13 ; AST: Stmt_for_body(c0);
15 ; IR: @foo.polly.subfn
17 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
18 target triple = "x86_64-unknown-linux-gnu"
20 define void @foo(i64 %cols, i8* noalias %call) {
22 %tmp = bitcast i8* %call to i64**
26 %indvar = phi i64 [ %indvar.next, %for.body ], [ 0, %entry ]
27 %arrayidx = getelementptr inbounds i64*, i64** %tmp, i64 0
28 %tmp1 = load i64** %arrayidx, align 8
29 %arrayidx.2 = getelementptr inbounds i64, i64* %tmp1, i64 %indvar
30 store i64 1, i64* %arrayidx.2, align 4
31 %indvar.next = add nsw i64 %indvar, 1
32 %cmp = icmp slt i64 %indvar.next, %cols
33 br i1 %cmp, label %for.body, label %end
39 ; Another variation of this test case, now with even more of the index
40 ; expression defined outside of the scop.
42 ; AST: #pragma omp parallel for
43 ; AST: for (int c0 = 0; c0 < cols; c0 += 1)
44 ; AST: Stmt_for_body(c0);
46 ; IR: @bar.polly.subfn
48 define void @bar(i64 %cols, i8* noalias %call) {
50 %tmp = bitcast i8* %call to i64**
51 %arrayidx = getelementptr inbounds i64*, i64** %tmp, i64 0
55 %indvar = phi i64 [ %indvar.next, %for.body ], [ 0, %entry ]
56 %tmp1 = load i64** %arrayidx, align 8
57 %arrayidx.2 = getelementptr inbounds i64, i64* %tmp1, i64 %indvar
58 store i64 1, i64* %arrayidx.2, align 4
59 %indvar.next = add nsw i64 %indvar, 1
60 %cmp = icmp slt i64 %indvar.next, %cols
61 br i1 %cmp, label %for.body, label %end