invariant_load_ptr_ptr_noalias.ll
1.94 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
; RUN: opt %loadPolly -tbaa -polly-scops -polly-invariant-load-hoisting=true -polly-ignore-aliasing \
; RUN: -analyze < %s | FileCheck %s
;
; Note: The order of the invariant accesses is important because A is the
; base pointer of tmp3 and we will generate code in the same order as
; the invariant accesses are listed here.
;
; CHECK: Invariant Accesses: {
; CHECK: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK: MemRef_A[42]
; CHECK: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK: MemRef_tmp3[32]
; CHECK: }
;
; CHECK: Arrays {
; CHECK: i32** MemRef_A[*];
; CHECK: i32* MemRef_tmp3[*]; [BasePtrOrigin: MemRef_A]
; CHECK: i32 MemRef_tmp5[*]; [BasePtrOrigin: MemRef_tmp3]
; CHECK: }
;
; CHECK: Arrays (Bounds as pw_affs) {
; CHECK: i32** MemRef_A[*];
; CHECK: i32* MemRef_tmp3[*]; [BasePtrOrigin: MemRef_A]
; CHECK: i32 MemRef_tmp5[*]; [BasePtrOrigin: MemRef_tmp3]
; CHECK: }
;
; void f(int ***A) {
; for (int i = 0; i < 1024; i++)
; A[42][32][i] = 0;
; }
;
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
define void @f(i32*** %A) {
bb:
br label %bb1
bb1: ; preds = %bb7, %bb
%indvars.iv = phi i64 [ %indvars.iv.next, %bb7 ], [ 0, %bb ]
%exitcond = icmp ne i64 %indvars.iv, 1024
br i1 %exitcond, label %bb2, label %bb8
bb2: ; preds = %bb1
%tmp = getelementptr inbounds i32**, i32*** %A, i64 42
%tmp3 = load i32**, i32*** %tmp, align 8
%tmp4 = getelementptr inbounds i32*, i32** %tmp3, i64 32
%tmp5 = load i32*, i32** %tmp4, align 8
%tmp6 = getelementptr inbounds i32, i32* %tmp5, i64 %indvars.iv
store i32 0, i32* %tmp6, align 4
br label %bb7
bb7: ; preds = %bb2
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
br label %bb1
bb8: ; preds = %bb1
ret void
}