• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt %loadPolly -polly-detect -analyze < %s | FileCheck %s
2
3target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
4
5declare float* @getNextBasePtr(float*) readnone nounwind
6
7define void @base_pointer_is_inst_inside_invariant_1(i64 %n, float* %A, float* %B) {
8entry:
9  br label %for.i
10
11for.i:
12  %indvar.i = phi i64 [ %indvar.i.next, %for.i.inc ], [ 0, %entry ]
13  br label %S1
14
15S1:
16; To get an instruction inside a region, we use a function without side
17; effects on which SCEV blocks, but for which it is still clear that the
18; return value remains invariant throughout the whole loop.
19  %ptr = call float* @getNextBasePtr(float* %A)
20  %conv = sitofp i64 %indvar.i to float
21  %arrayidx5 = getelementptr float, float* %ptr, i64 %indvar.i
22  store float %conv, float* %arrayidx5, align 4
23  store float 1.0, float* %B
24  br label %for.i.inc
25
26for.i.inc:
27  %indvar.i.next = add i64 %indvar.i, 1
28  %exitcond.i = icmp ne i64 %indvar.i.next, %n
29  br i1 %exitcond.i, label %for.i, label %exit
30
31exit:
32  ret void
33}
34
35; CHECK-NOT: Valid Region for Scop
36