summaryrefslogtreecommitdiff
path: root/polly/test/GPGPU/bounds-construction-with-ignore-param-bounds.ll
blob: a60744289885eecc76fb947da24f2783b7dfa02a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
; RUN: opt %loadPolly -S -polly-codegen-ppcg \
; RUN: -polly-ignore-parameter-bounds \
; RUN: -polly-invariant-load-hoisting < %s| FileCheck %s -check-prefix=HOST-IR
;
; REQUIRES: pollyacc

; When we have `-polly-ignore-parameter-bounds`, `Scop::Context` does not contain
; all the parameters present in the program.
;
; The construction of the `isl_multi_pw_aff` requires all the indivisual `pw_aff`
; to have the same parameter dimensions. To achieve this, we used to realign
; every `pw_aff` with `Scop::Context`. However, in conjunction with
; `-polly-ignore-parameter-bounds`, this is now incorrect, since `Scop::Context`
; does not contain all parameters.
;
; We check that Polly does the right thing in this case and sets up the parameter
; dimensions correctly.


; Check that kernel launch is generated in host IR.
; the declare would not be generated unless a call to a kernel exists.
; HOST-IR: declare void @polly_launchKernel(ptr, i32, i32, i32, i32, i32, ptr)
; ModuleID = 'test/GPGPU/bounds-construction-with-ignore-param-bounds.ll'

; C pseudocode
; ------------
; void f(int *arr, long niters, long stride) {
;     for(int i = 0; i < niters; i++) {
;       arr[i * stride] = 1;
;     }
; }

target 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"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: nounwind uwtable
define void @f(ptr %arr, i64 %niters, i64 %stride) unnamed_addr #1 {
entry:
  br label %loop

loop:                                             ; preds = %loop, %entry
  %indvar = phi i64 [ 0, %entry ], [ %indvar.next, %loop ]
  %idx = mul nuw nsw i64 %indvar, %stride
  %slot = getelementptr i32, ptr %arr, i64 %idx
  store i32 1, ptr %slot, align 4
  %indvar.next = add nuw nsw i64 %indvar, 1
  %check = icmp sgt i64 %indvar.next, %niters
  br i1 %check, label %exit, label %loop

exit:                                             ; preds = %loop
  ret void
}

attributes #0 = { nounwind }
attributes #1 = { nounwind uwtable }