[ForwardOpTree] Use known array content analysis to forward load instructions.
[polly-mirror.git] / test / Simplify / notredundant_region_middle.ll
blobcadbc1724fcaf5e059fd09b0d0e53d7c3d74928b
1 ; RUN: opt %loadPolly -polly-import-jscop -polly-import-jscop-postfix=transformed -polly-simplify -analyze < %s | FileCheck %s -match-full-lines
3 ; Do not remove redundant stores in the middle of region statements.
4 ; The store in region_true could be removed, but in practice we do try to
5 ; determine the relative ordering of block in region statements.
7 ; for (int j = 0; j < n; j += 1) {
8 ;   double val = A[0];
9 ;   if (val == 0.0)
10 ;     A[0] = val;
11 ;   else
12 ;     A[0] = 0.0;
13 ; }
15 define void @notredundant_region(i32 %n, double* noalias nonnull %A) {
16 entry:
17   br label %for
19 for:
20   %j = phi i32 [0, %entry], [%j.inc, %inc]
21   %j.cmp = icmp slt i32 %j, %n
22   br i1 %j.cmp, label %region_entry, label %exit
25     region_entry:
26       %val = load double, double* %A
27       %cmp = fcmp oeq double %val, 0.0
28       br i1 %cmp, label %region_true, label %region_false
30     region_true:
31       store double %val, double* %A
32       br label %region_exit
34     region_false:
35       store double 0.0, double* %A
36       br label %region_exit
38     region_exit:
39       br label %inc
42 inc:
43   %j.inc = add nuw nsw i32 %j, 1
44   br label %for
46 exit:
47   br label %return
49 return:
50   ret void
54 ; CHECK: SCoP could not be simplified