Fix two warnings in polly, -Wmismatched-tags and -Wreorder
[polly-mirror.git] / test / ScopInfo / partially_invariant_load_2.ll
blob4269c3270d36ae38b590541f17aa4a5bdcac0060
1 ; RUN: opt %loadPolly -polly-scops -polly-invariant-load-hoisting=true -analyze < %s | FileCheck %s
3 ; Check that we do not try to preload *I and assume p != 42.
5 ; CHECK:      Invariant Accesses: {
6 ; CHECK-NEXT: }
8 ; CHECK:      Invalid Context:
9 ; CHECK-NEXT: [N, p] -> {  : 1 = 0 }
11 ; CHECK:      Stmt_if_then__TO__if_end
12 ; CHECK-NEXT:   Domain :=
13 ; CHECK-NEXT:   [N, p] -> { Stmt_if_then__TO__if_end[i0] : p = 42 and 0 <= i0 < N };
15 ;    void f(int *A, int *I, int N, int p, int q) {
16 ;      for (int i = 0; i < N; i++) {
17 ;        if (p == 42) {
18 ;          *I = 0;
19 ;          if (*I == q)
20 ;            A[i] *= 2;
21 ;        }
22 ;        A[i]++;
23 ;      }
24 ;    }
26 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
28 define void @f(i32* %A, i32* %I, i32 %N, i32 %p, i32 %q) {
29 entry:
30   %tmp = sext i32 %N to i64
31   br label %for.cond
33 for.cond:                                         ; preds = %for.inc, %entry
34   %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
35   %cmp = icmp slt i64 %indvars.iv, %tmp
36   br i1 %cmp, label %for.body, label %for.end
38 for.body:                                         ; preds = %for.cond
39   %cmp1 = icmp eq i32 %p, 42
40   br i1 %cmp1, label %if.then, label %if.end4
42 if.then:                                          ; preds = %for.body
43   store i32 0, i32* %I, align 4
44   %tmp1 = load i32, i32* %I, align 4
45   %cmp2 = icmp eq i32 %tmp1, %q
46   br i1 %cmp2, label %if.then3, label %if.end
48 if.then3:                                         ; preds = %if.then
49   %arrayidx = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
50   %tmp2 = load i32, i32* %arrayidx, align 4
51   %mul = shl nsw i32 %tmp2, 1
52   store i32 %mul, i32* %arrayidx, align 4
53   br label %if.end
55 if.end:                                           ; preds = %if.then3, %if.then
56   br label %if.end4
58 if.end4:                                          ; preds = %if.end, %for.body
59   %arrayidx6 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
60   %tmp3 = load i32, i32* %arrayidx6, align 4
61   %inc = add nsw i32 %tmp3, 1
62   store i32 %inc, i32* %arrayidx6, align 4
63   br label %for.inc
65 for.inc:                                          ; preds = %if.end4
66   %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
67   br label %for.cond
69 for.end:                                          ; preds = %for.cond
70   ret void