1; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s
2;
3; Verify we do not generate an empty invalid context only because the wrap
4; in the second conditional will always happen if the block is executed.
5;
6; CHECK:       Invalid Context:
7; CHECK-NEXT:    [N] -> {  : N > 0 }
8;
9;    void f(char *A, char N) {
10;      for (char i = 0; i < 10; i++) {
11;        if (N > 0)
12;          if (1 + 127 * N > 0)
13;            A[i] = 1;
14;        A[i] = 0;
15;      }
16;    }
17;
18target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
19
20define void @f(i8* %A, i8 signext %N) {
21entry:
22  br label %for.cond
23
24for.cond:                                         ; preds = %for.inc, %entry
25  %indvars.iv = phi i8 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
26  %exitcond = icmp ne i8 %indvars.iv, 10
27  br i1 %exitcond, label %for.body, label %for.end
28
29for.body:                                         ; preds = %for.cond
30  %cmp3 = icmp sgt i8 %N, 0
31  br i1 %cmp3, label %if.then, label %if.end10
32
33if.then:                                           ; preds = %for.body
34  %mul = mul i8 %N, 127
35  %add = add i8 1, %mul
36  %cmp7 = icmp sgt i8 %add, 0
37  br i1 %cmp7, label %if.then9, label %if.end10
38
39if.then9:                                         ; preds = %if.end
40  %arrayidx = getelementptr inbounds i8, i8* %A, i8 %indvars.iv
41  store i8 1, i8* %arrayidx, align 1
42  br label %if.end10
43
44if.end10:                                         ; preds = %if.then9, %if.end
45  %arrayidx12 = getelementptr inbounds i8, i8* %A, i8 %indvars.iv
46  store i8 0, i8* %arrayidx12, align 1
47  br label %for.inc
48
49for.inc:                                          ; preds = %if.end10, %if.then
50  %indvars.iv.next = add nuw nsw i8 %indvars.iv, 1
51  br label %for.cond
52
53for.end:                                          ; preds = %for.cond
54  ret void
55}
56