• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt %loadPolly -S -polly-codegen-ppcg \
2; RUN: -polly-ignore-parameter-bounds \
3; RUN: -polly-invariant-load-hoisting < %s| FileCheck %s -check-prefix=HOST-IR
4;
5; REQUIRES: pollyacc
6
7; When we have `-polly-ignore-parameter-bounds`, `Scop::Context` does not contain
8; all the parameters present in the program.
9;
10; The construction of the `isl_multi_pw_aff` requires all the indivisual `pw_aff`
11; to have the same parameter dimensions. To achieve this, we used to realign
12; every `pw_aff` with `Scop::Context`. However, in conjunction with
13; `-polly-ignore-parameter-bounds`, this is now incorrect, since `Scop::Context`
14; does not contain all parameters.
15;
16; We check that Polly does the right thing in this case and sets up the parameter
17; dimensions correctly.
18
19
20; Check that kernel launch is generated in host IR.
21; the declare would not be generated unless a call to a kernel exists.
22; HOST-IR: declare void @polly_launchKernel(i8*, i32, i32, i32, i32, i32, i8*)
23; ModuleID = 'test/GPGPU/bounds-construction-with-ignore-param-bounds.ll'
24
25; C pseudocode
26; ------------
27; void f(int *arr, long niters, long stride) {
28;     for(int i = 0; i < niters; i++) {
29;       arr[i * stride] = 1;
30;     }
31; }
32
33target datalayout = "e-p:64:64:64-S128-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f16:16:16-f32:32:32-f64:64:64-f128:128:128-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
34target triple = "x86_64-unknown-linux-gnu"
35
36; Function Attrs: nounwind uwtable
37define void @f(i32 *%arr, i64 %niters, i64 %stride) unnamed_addr #1 {
38entry:
39  br label %loop
40
41loop:                                             ; preds = %loop, %entry
42  %indvar = phi i64 [ 0, %entry ], [ %indvar.next, %loop ]
43  %idx = mul nuw nsw i64 %indvar, %stride
44  %slot = getelementptr i32, i32* %arr, i64 %idx
45  store i32 1, i32* %slot, align 4
46  %indvar.next = add nuw nsw i64 %indvar, 1
47  %check = icmp sgt i64 %indvar.next, %niters
48  br i1 %check, label %exit, label %loop
49
50exit:                                             ; preds = %loop
51  ret void
52}
53
54attributes #0 = { nounwind }
55attributes #1 = { nounwind uwtable }
56