File: independent-interleaved.ll

package info (click to toggle)
llvm-toolchain-9 1%3A9.0.1-16.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 882,388 kB
  • sloc: cpp: 4,167,636; ansic: 714,256; asm: 457,610; python: 155,927; objc: 65,094; sh: 42,856; lisp: 26,908; perl: 7,786; pascal: 7,722; makefile: 6,881; ml: 5,581; awk: 3,648; cs: 2,027; xml: 888; javascript: 381; ruby: 156
file content (46 lines) | stat: -rw-r--r-- 1,435 bytes parent folder | download | duplicates (11)
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
; RUN: opt < %s -store-to-load-forwarding-conflict-detection=false -loop-accesses -analyze | FileCheck %s
; RUN: opt -passes='require<scalar-evolution>,require<aa>,loop(print-access-info)' -store-to-load-forwarding-conflict-detection=false  -disable-output  < %s 2>&1 | FileCheck %s

; This test checks that we prove the strided accesses to be independent before
; concluding that there is a forward dependence.

; struct pair {
;   int x;
;   int y;
; };
;
; int independent_interleaved(struct pair *p, int z, int n) {
;   int s = 0;
;   for (int i = 0; i < n; i++) {
;     p[i].y = z;
;     s += p[i].x;
;   }
;   return s;
; }

; CHECK:     for.body:
; CHECK-NOT:     Forward:
; CHECK-NOT:         store i32 %z, i32* %p_i.y, align 8 ->
; CHECK-NOT:         %0 = load i32, i32* %p_i.x, align 8

%pair = type { i32, i32 }
define i32 @independent_interleaved(%pair *%p, i64 %n, i32 %z) {
entry:
  br label %for.body

for.body:
  %i = phi i64 [ %i.next, %for.body ], [ 0, %entry ]
  %s = phi i32 [ %1, %for.body ], [ 0, %entry ]
  %p_i.x = getelementptr inbounds %pair, %pair* %p, i64 %i, i32 0
  %p_i.y = getelementptr inbounds %pair, %pair* %p, i64 %i, i32 1
  store i32 %z, i32* %p_i.y, align 8
  %0 = load i32, i32* %p_i.x, align 8
  %1 = add nsw i32 %0, %s
  %i.next = add nuw nsw i64 %i, 1
  %cond = icmp slt i64 %i.next, %n
  br i1 %cond, label %for.body, label %for.end

for.end:
  %2 = phi i32 [ %1, %for.body ]
  ret i32 %2
}