File: merge_store_duplicated_loads.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 (88 lines) | stat: -rw-r--r-- 3,418 bytes parent folder | download | duplicates (13)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu -mcpu=corei7 -o - | FileCheck %s


target triple = "x86_64-unknown-linux-gnu"

define void @merge_double(ptr noalias nocapture %st, ptr noalias nocapture readonly %ld) #0 {
; CHECK-LABEL: merge_double:
; CHECK:       # %bb.0:
; CHECK-NEXT:    movsd {{.*#+}} xmm0 = mem[0],zero
; CHECK-NEXT:    movsd {{.*#+}} xmm1 = mem[0],zero
; CHECK-NEXT:    movsd %xmm0, (%rdi)
; CHECK-NEXT:    movsd %xmm1, 8(%rdi)
; CHECK-NEXT:    movsd %xmm0, 16(%rdi)
; CHECK-NEXT:    movsd %xmm1, 24(%rdi)
; CHECK-NEXT:    retq
  %ld_idx1 = getelementptr inbounds double, ptr %ld, i64 1
  %ld0 = load double, ptr %ld, align 8, !tbaa !2
  %ld1 = load double, ptr %ld_idx1, align 8, !tbaa !2

  %st_idx1 = getelementptr inbounds double, ptr %st, i64 1
  %st_idx2 = getelementptr inbounds double, ptr %st, i64 2
  %st_idx3 = getelementptr inbounds double, ptr %st, i64 3

  store double %ld0, ptr %st, align 8, !tbaa !2
  store double %ld1, ptr %st_idx1, align 8, !tbaa !2
  store double %ld0, ptr %st_idx2, align 8, !tbaa !2
  store double %ld1, ptr %st_idx3, align 8, !tbaa !2
  ret void
}

define void @merge_loadstore_int(ptr noalias nocapture readonly %p, ptr noalias nocapture %q) local_unnamed_addr #0 {
; CHECK-LABEL: merge_loadstore_int:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    movq (%rdi), %rax
; CHECK-NEXT:    movq 8(%rdi), %rcx
; CHECK-NEXT:    movq %rax, (%rsi)
; CHECK-NEXT:    movq %rcx, 8(%rsi)
; CHECK-NEXT:    movq %rax, 16(%rsi)
; CHECK-NEXT:    movq %rcx, 24(%rsi)
; CHECK-NEXT:    retq
entry:
  %0 = load i64, ptr %p, align 8, !tbaa !1
  %arrayidx1 = getelementptr inbounds i64, ptr %p, i64 1
  %1 = load i64, ptr %arrayidx1, align 8, !tbaa !1
  store i64 %0, ptr %q, align 8, !tbaa !1
  %arrayidx3 = getelementptr inbounds i64, ptr %q, i64 1
  store i64 %1, ptr %arrayidx3, align 8, !tbaa !1
  %arrayidx4 = getelementptr inbounds i64, ptr %q, i64 2
  store i64 %0, ptr %arrayidx4, align 8, !tbaa !1
  %arrayidx5 = getelementptr inbounds i64, ptr %q, i64 3
  store i64 %1, ptr %arrayidx5, align 8, !tbaa !1
  ret void
}

define i64 @merge_loadstore_int_with_extra_use(ptr noalias nocapture readonly %p, ptr noalias nocapture %q) local_unnamed_addr #0 {
; CHECK-LABEL: merge_loadstore_int_with_extra_use:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    movq (%rdi), %rax
; CHECK-NEXT:    movq 8(%rdi), %rcx
; CHECK-NEXT:    movq %rax, (%rsi)
; CHECK-NEXT:    movq %rcx, 8(%rsi)
; CHECK-NEXT:    movq %rax, 16(%rsi)
; CHECK-NEXT:    movq %rcx, 24(%rsi)
; CHECK-NEXT:    retq
entry:
  %0 = load i64, ptr %p, align 8, !tbaa !1
  %arrayidx1 = getelementptr inbounds i64, ptr %p, i64 1
  %1 = load i64, ptr %arrayidx1, align 8, !tbaa !1
  store i64 %0, ptr %q, align 8, !tbaa !1
  %arrayidx3 = getelementptr inbounds i64, ptr %q, i64 1
  store i64 %1, ptr %arrayidx3, align 8, !tbaa !1
  %arrayidx4 = getelementptr inbounds i64, ptr %q, i64 2
  store i64 %0, ptr %arrayidx4, align 8, !tbaa !1
  %arrayidx5 = getelementptr inbounds i64, ptr %q, i64 3
  store i64 %1, ptr %arrayidx5, align 8, !tbaa !1
  ret i64 %0

}

attributes #0 = { "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" }


!0 = !{!"clang version 5.0.0 (trunk 296467) (llvm/trunk 296476)"}
!1 = !{!2, !2, i64 0}
!2 = !{!"double", !3, i64 0}
!3 = !{!"omnipotent char", !4, i64 0}
!4 = !{!"Simple C/C++ TBAA"}