File: combine-parallel-mem-md.ll

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,799,624 kB
  • sloc: cpp: 6,428,607; ansic: 1,383,196; asm: 793,408; python: 223,504; objc: 75,364; f90: 60,502; lisp: 33,869; pascal: 15,282; sh: 9,684; perl: 7,453; ml: 4,937; awk: 3,523; makefile: 2,889; javascript: 2,149; xml: 888; fortran: 619; cs: 573
file content (56 lines) | stat: -rw-r--r-- 2,482 bytes parent folder | download | duplicates (12)
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
; RUN: opt -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S < %s | FileCheck %s
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: norecurse nounwind uwtable
define void @Test(ptr nocapture %res, ptr nocapture readnone %c, ptr nocapture readonly %d, ptr nocapture readonly %p) #0 {
entry:
  br label %for.body

; CHECK-LABEL: @Test
; CHECK: load i32, ptr {{.*}}, align 4, !llvm.access.group !0
; CHECK: load i32, ptr {{.*}}, align 4, !llvm.access.group !0
; CHECK: store i32 {{.*}}, align 4, !llvm.access.group !0
; CHECK-NOT: load
; CHECK-NOT: store

for.body:                                         ; preds = %cond.end, %entry
  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %cond.end ]
  %arrayidx = getelementptr inbounds i32, ptr %p, i64 %indvars.iv
  %0 = load i32, ptr %arrayidx, align 4, !llvm.access.group !10
  %cmp1 = icmp eq i32 %0, 0
  br i1 %cmp1, label %cond.true, label %cond.false

cond.false:                                       ; preds = %for.body
  %arrayidx3 = getelementptr inbounds i32, ptr %res, i64 %indvars.iv
  %v = load i32, ptr %arrayidx3, align 4, !llvm.access.group !10
  %arrayidx7 = getelementptr inbounds i32, ptr %d, i64 %indvars.iv
  %1 = load i32, ptr %arrayidx7, align 4, !llvm.access.group !10
  %add = add nsw i32 %1, %v
  br label %cond.end

cond.true:                                       ; preds = %for.body
  %arrayidx4 = getelementptr inbounds i32, ptr %res, i64 %indvars.iv
  %w = load i32, ptr %arrayidx4, align 4, !llvm.access.group !10
  %arrayidx8 = getelementptr inbounds i32, ptr %d, i64 %indvars.iv
  %2 = load i32, ptr %arrayidx8, align 4, !llvm.access.group !10
  %add2 = add nsw i32 %2, %w
  br label %cond.end

cond.end:                                         ; preds = %for.body, %cond.false
  %cond = phi i32 [ %add, %cond.false ], [ %add2, %cond.true ]
  %arrayidx9 = getelementptr inbounds i32, ptr %res, i64 %indvars.iv
  store i32 %cond, ptr %arrayidx9, align 4, !llvm.access.group !10
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond = icmp eq i64 %indvars.iv.next, 16
  br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !0

for.end:                                          ; preds = %cond.end
  ret void
}

attributes #0 = { norecurse nounwind uwtable }

!0 = distinct !{!0, !1, !{!"llvm.loop.parallel_accesses", !10}}
!1 = !{!"llvm.loop.vectorize.enable", i1 true}
!10 = distinct !{}