[ScopBuilder/Simplify] Refactor isEscaping. NFC.
[polly-mirror.git] / test / ScopInfo / restriction_in_dead_block.ll
blobc06cd7cf7bb3dff0aeb68b640b511744ffc0d9ef
1 ; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s
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.
6 ; CHECK:       Invalid Context:
7 ; CHECK-NEXT:    [N] -> {  : N > 0 }
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 ;    }
18 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
20 define void @f(i8* %A, i8 signext %N) {
21 entry:
22   br label %for.cond
24 for.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
29 for.body:                                         ; preds = %for.cond
30   %cmp3 = icmp sgt i8 %N, 0
31   br i1 %cmp3, label %if.then, label %if.end10
33 if.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
39 if.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
44 if.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
49 for.inc:                                          ; preds = %if.end10, %if.then
50   %indvars.iv.next = add nuw nsw i8 %indvars.iv, 1
51   br label %for.cond
53 for.end:                                          ; preds = %for.cond
54   ret void