summaryrefslogtreecommitdiffstats
path: root/polly/test/Isl/CodeGen/scalar-references-used-in-scop-compute.ll
blob: fe32e64c1ba60f166352575bf6bbd48c178c4bcf (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
; RUN: opt %loadPolly -polly-codegen -S < %s | FileCheck %s

; Test the code generation in the presence of a scalar out-of-scop value being
; used from within the SCoP.

; CHECH-LABEL: @scalar-function-argument
; CHECK: polly.split_new_and_old


target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"

define void @scalar-function-argument(float* %A, float %sqrinv) {
entry:
  br label %for.body

for.body:
  %indvar = phi i64 [ %indvar.next, %for.body ], [ 0, %entry ]
  %mul104 = fmul float 1.0, %sqrinv
  %rp107 = getelementptr float, float* %A, i64 %indvar
  store float %mul104, float* %rp107, align 4
  %indvar.next = add nsw i64 %indvar, 1
  %cmp = icmp slt i64 1024, %indvar.next
  br i1 %cmp, label %for.end, label %for.body

for.end:
  ret void
}

; CHECH-LABEL: @scalar-outside-of-scop
; CHECK: polly.split_new_and_old

define void @scalar-outside-of-scop(float* %A) {
entry:
  %sqrinv = call float @getFloat()
  br label %for.body

for.body:
  %indvar = phi i64 [ %indvar.next, %for.body ], [ 0, %entry ]
  %mul104 = fmul float 1.0, %sqrinv
  %rp107 = getelementptr float, float* %A, i64 %indvar
  store float %mul104, float* %rp107, align 4
  %indvar.next = add nsw i64 %indvar, 1
  %cmp = icmp slt i64 1024, %indvar.next
  br i1 %cmp, label %for.end, label %for.body

for.end:
  ret void
}

declare float @getFloat()
OpenPOWER on IntegriCloud