map_memset_zero.ll
2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
; RUN: opt %loadPolly -polly-stmt-granularity=bb -polly-delicm -analyze < %s | FileCheck -match-full-lines %s
;
; Check that PHI mapping works even in presence of a memset whose'
; zero value is used.
;
declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1)
define void @func(i8* noalias nonnull %A) {
entry:
br label %outer.for
outer.for:
%j = phi i32 [0, %entry], [%j.inc, %outer.inc]
%j.cmp = icmp slt i32 %j, 2
br i1 %j.cmp, label %bodyA, label %outer.exit
bodyA:
%A_idx = getelementptr inbounds i8, i8* %A, i32 %j
%cond = icmp eq i32 21, 21
br i1 %cond, label %bodyB, label %bodyC
bodyB:
call void @llvm.memset.p0i8.i64(i8* %A_idx, i8 0, i64 1, i32 1, i1 false)
br label %bodyC
bodyC:
%phi = phi i8 [1, %bodyA], [0, %bodyB]
%a = load i8, i8* %A_idx
store i8 %phi, i8* %A_idx
br label %outer.inc
outer.inc:
%j.inc = add nuw nsw i32 %j, 1
br label %outer.for
outer.exit:
br label %return
return:
ret void
}
; CHECK: Statistics {
; CHECK: Compatible overwrites: 1
; CHECK: Overwrites mapped to: 1
; CHECK: PHI scalars mapped: 1
; CHECK: }
; CHECK: After accesses {
; CHECK-NEXT: Stmt_bodyA
; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
; CHECK-NEXT: { Stmt_bodyA[i0] -> MemRef_phi__phi[] };
; CHECK-NEXT: new: { Stmt_bodyA[i0] -> MemRef_A[o0] : false };
; CHECK-NEXT: Stmt_bodyB
; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT: { Stmt_bodyB[i0] -> MemRef_A[i0] };
; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
; CHECK-NEXT: { Stmt_bodyB[i0] -> MemRef_phi__phi[] };
; CHECK-NEXT: new: { Stmt_bodyB[i0] -> MemRef_A[i0] };
; CHECK-NEXT: Stmt_bodyC
; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
; CHECK-NEXT: { Stmt_bodyC[i0] -> MemRef_phi__phi[] };
; CHECK-NEXT: new: { Stmt_bodyC[i0] -> MemRef_A[i0] };
; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT: { Stmt_bodyC[i0] -> MemRef_A[i0] };
; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT: { Stmt_bodyC[i0] -> MemRef_A[i0] };
; CHECK-NEXT: }