Update Polly tests to handle explicitly typed gep changes in LLVM
[polly-mirror.git] / test / IndependentBlocks / intra_and_inter_bb_scalar_dep.ll
blobc17fc09d448a02c2bd71c30625eac92b117614e7
1 ; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-independent -S < %s | FileCheck %s
2 ; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-independent -S < %s | FileCheck %s
3 ; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-independent -disable-polly-intra-scop-scalar-to-array -S < %s | FileCheck %s -check-prefix=SCALARACCESS
4 ; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-independent -disable-polly-intra-scop-scalar-to-array -S < %s | FileCheck %s -check-prefix=SCALARACCESS
6 ; void f(long A[], int N, int *init_ptr) {
7 ;   long i, j;
9 ;   for (i = 0; i < N; ++i) {
10 ;     init = *init_ptr;
11 ;     for (i = 0; i < N; ++i) {
12 ;       init2 = *init_ptr;
13 ;       A[i] = init + init2;
14 ;     }
15 ;   }
16 ; }
18 target 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"
19 target triple = "x86_64-unknown-linux-gnu"
21 define void @f(i64* noalias %A, i64 %N, i64* noalias %init_ptr) nounwind {
22 entry:
24 ; CHECK: entry
25 ; CHECK: %init.s2a = alloca i64
26 ; CHECK: br label %for.i
28 ; SCALARACCESS-NOT: alloca
29   br label %for.i
31 for.i:
32   %indvar.i = phi i64 [ 0, %entry ], [ %indvar.i.next, %for.i.end ]
33   %indvar.i.next = add nsw i64 %indvar.i, 1
34   br label %entry.next
36 entry.next:
37   %init = load i64* %init_ptr
38 ; SCALARACCESS-NOT: store
39   br label %for.j
41 for.j:
42   %indvar.j = phi i64 [ 0, %entry.next ], [ %indvar.j.next, %for.j ]
43   %init_2 = load i64* %init_ptr
44   %init_sum = add i64 %init, %init_2
45 ; CHECK: %init_2 = load i64* %init_ptr
46 ; CHECK: %init.loadarray = load i64* %init.s2a
47 ; CHECK: %init_sum = add i64 %init.loadarray, %init_2
49 ; The SCEV of %init_sum is (%init + %init_2). It is referring to both an
50 ; UnknownValue in the same and in a different basic block. We want only the
51 ; reference to the different basic block to be replaced.
53 ; SCALARACCESS: %init_2 = load i64* %init_ptr
54 ; SCALARACCESS: %init_sum = add i64 %init, %init_2
55   %scevgep = getelementptr i64, i64* %A, i64 %indvar.j
56   store i64 %init_sum, i64* %scevgep
57   %indvar.j.next = add nsw i64 %indvar.j, 1
58   %exitcond.j = icmp eq i64 %indvar.j.next, %N
59   br i1 %exitcond.j, label %for.i.end, label %for.j
61 for.i.end:
62   %exitcond.i = icmp eq i64 %indvar.i.next, %N
63   br i1 %exitcond.i, label %return, label %for.i
65 return:
66   ret void