• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt %loadPolly -disable-output -polly-acc-dump-kernel-ir \
2; RUN: -polly-codegen-ppcg -polly-scops \
3; RUN: -polly-invariant-load-hoisting < %s | FileCheck %s
4
5; REQUIRES: pollyacc
6
7; Verify that invariant loads used in a kernel statement are correctly forwarded
8; as subtree value to the GPU kernel.
9
10; CHECK:  define ptx_kernel void @FUNC_foo_SCOP_0_KERNEL_0({{.*}} float %polly.access.p.load)
11; CHECK:   store float %polly.access.p.load, float* %indvar2f.phiops
12
13define void @foo(float* %A, float* %p) {
14entry:
15  br label %loop
16
17loop:
18  %indvar = phi i64 [0, %entry], [%indvar.next, %loop]
19  %indvar.next = add i64 %indvar, 1
20  %invariant = load float, float* %p
21  %ptr = getelementptr float, float* %A, i64 %indvar
22  store float 42.0, float* %ptr
23  %cmp = icmp sle i64 %indvar, 1024
24  br i1 %cmp, label %loop, label %loop2
25
26loop2:
27  %indvar2 = phi i64 [0, %loop], [%indvar2.next, %loop2]
28  %indvar2f = phi float [%invariant, %loop], [%indvar2f, %loop2]
29  %indvar2.next = add i64 %indvar2, 1
30  store float %indvar2f, float* %A
31  %cmp2 = icmp sle i64 %indvar2, 1024
32  br i1 %cmp2, label %loop2, label %end
33
34end:
35  ret void
36
37}
38