Update Polly tests to handle explicitly typed gep changes in LLVM
[polly-mirror.git] / test / IndependentBlocks / intra_bb_scalar_dep.ll
blob07d8b81885dd84d39686b496fe18e158dd11c099
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
4 ; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-independent -disable-polly-intra-scop-scalar-to-array -S < %s | FileCheck %s
6 ; void f(long A[], int N, int *init_ptr) {
7 ;   long i, j;
9 ;   for (i = 0; i < N; ++i) {
10 ;     for (i = 0; i < N; ++i) {
11 ;       init = *init_ptr;
12 ;       A[i] = init + 2;
13 ;     }
14 ;   }
15 ; }
17 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"
18 target triple = "x86_64-unknown-linux-gnu"
20 define void @f(i64* noalias %A, i64 %N, i64* noalias %init_ptr) nounwind {
21 entry:
23 ; CHECK: entry
24 ; CHECK: br label %for.i
25   br label %for.i
27 for.i:
28   %indvar.i = phi i64 [ 0, %entry ], [ %indvar.i.next, %for.i.end ]
29   %indvar.i.next = add nsw i64 %indvar.i, 1
30   br label %entry.next
32 entry.next:
33   br label %for.j
35 for.j:
36   %indvar.j = phi i64 [ 0, %entry.next ], [ %indvar.j.next, %for.j ]
37   %init = load i64* %init_ptr
38   %init_plus_two = add i64 %init, 2
39 ; The scalar evolution of %init_plus_two is (2 + %init). So we have a
40 ; non-trivial scalar evolution referring to a value in the same basic block.
41 ; We want to ensure that this scalar is not translated into a memory copy.
42   %scevgep = getelementptr i64, i64* %A, i64 %indvar.j
43   store i64 %init_plus_two, i64* %scevgep
44   %indvar.j.next = add nsw i64 %indvar.j, 1
45   %exitcond.j = icmp eq i64 %indvar.j.next, %N
46   br i1 %exitcond.j, label %for.i.end, label %for.j
48 for.i.end:
49   %exitcond.i = icmp eq i64 %indvar.i.next, %N
50   br i1 %exitcond.i, label %return, label %for.i
52 return:
53   ret void