1; RUN: opt %loadPolly -polly-stmt-granularity=bb -polly-import-jscop -polly-import-jscop-postfix=transformed -polly-codegen -S < %s | FileCheck %s
2;
3; Partial write of a (mapped) scalar.
4;
5; for (int j = 0; j < n; j += 1) {
6;body:
7;   val = 21.0 + 21.0;
8;   if (j >= 5)
9;user:
10;     A[0] = val;
11; }
12
13define void @partial_write_mapped_scalar(i32 %n, double* noalias nonnull %A) {
14entry:
15  br label %for
16
17for:
18  %j = phi i32 [0, %entry], [%j.inc, %inc]
19  %j.cmp = icmp slt i32 %j, %n
20  br i1 %j.cmp, label %body, label %exit
21
22    body:
23      %val = fadd double 21.0, 21.0
24      %if.cond = icmp sgt i32 %j, 5
25      br i1 %if.cond, label %user, label %inc
26
27    user:
28      store double %val, double* %A
29      br label %inc
30
31inc:
32  %j.inc = add nuw nsw i32 %j, 1
33  br label %for
34
35exit:
36  br label %return
37
38return:
39  ret void
40}
41
42
43; CHECK:      polly.stmt.body:
44; CHECK-NEXT:   %p_val = fadd double 2.100000e+01, 2.100000e+01
45; CHECK-NEXT:   %1 = trunc i64 %polly.indvar to i32
46; CHECK-NEXT:   %p_if.cond = icmp sgt i32 %1, 5
47; CHECK-NEXT:   %2 = icmp sge i64 %polly.indvar, 5
48; CHECK-NEXT:   %polly.Stmt_body_Write0.cond = icmp ne i1 %2, false
49; CHECK-NEXT:   br i1 %polly.Stmt_body_Write0.cond, label %polly.stmt.body.Stmt_body_Write0.partial, label %polly.stmt.body.cont
50
51; CHECK:      polly.stmt.body.Stmt_body_Write0.partial:
52; CHECK-NEXT:   %polly.access.A = getelementptr double, double* %A, i64 1
53; CHECK-NEXT:   store double %p_val, double* %polly.access.A
54; CHECK-NEXT:   br label %polly.stmt.body.cont
55
56; CHECK:      polly.stmt.body.cont:
57; CHECK-NEXT:   br label %polly.cond
58