xref: /llvm-project/polly/test/Simplify/notredundant_region_middle.ll (revision e1f056f692d869708c1898d9d65a69ac5584a0ed)
1; RUN: opt %loadNPMPolly "-passes=scop(print<polly-simplify>)" -disable-output -aa-pipeline=basic-aa < %s | FileCheck %s -match-full-lines
2;
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.
6;
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; }
14;
15define void @notredundant_region(i32 %n, ptr noalias nonnull %A) {
16entry:
17  br label %for
18
19for:
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
23
24
25    region_entry:
26      %val = load double, ptr %A
27      %cmp = fcmp oeq double %val, 0.0
28      br i1 %cmp, label %region_true, label %region_false
29
30    region_true:
31      store double %val, ptr %A
32      br label %region_exit
33
34    region_false:
35      store double 0.0, ptr %A
36      br label %region_exit
37
38    region_exit:
39      br label %inc
40
41
42inc:
43  %j.inc = add nuw nsw i32 %j, 1
44  br label %for
45
46exit:
47  br label %return
48
49return:
50  ret void
51}
52
53
54; CHECK: SCoP could not be simplified
55