File: merge-tbaa.ll

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 1,998,492 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (47 lines) | stat: -rw-r--r-- 1,469 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
; RUN: opt -mtriple=x86_64-unknown-linux-gnu -passes=load-store-vectorizer -S < %s | \
; RUN:     FileCheck %s
; RUN: opt -mtriple=x86_64-unknown-linux-gnu -aa-pipeline=basic-aa -passes='function(load-store-vectorizer)' -S < %s | \
; RUN:     FileCheck %s
;
; The GPU Load & Store Vectorizer may merge differently-typed accesses into a
; single instruction. This test checks that we merge TBAA tags for such
; accesses correctly.

target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"

; struct S {
;   float f;
;   int i;
; };
%struct.S = type { float, i32 }

; float foo(S *p) {
;   p->f -= 1;
;   p->i -= 1;
;   return p->f;
; }
define float @foo(ptr %p) {
entry:
; CHECK-LABEL: foo
; CHECK: load <2 x i32>, {{.*}}, !tbaa [[TAG_char:!.*]]
; CHECK: store <2 x i32> {{.*}}, !tbaa [[TAG_char]]
  %0 = load float, ptr %p, align 4, !tbaa !2
  %sub = fadd float %0, -1.000000e+00
  store float %sub, ptr %p, align 4, !tbaa !2
  %i = getelementptr inbounds %struct.S, ptr %p, i64 0, i32 1
  %1 = load i32, ptr %i, align 4, !tbaa !8
  %sub1 = add nsw i32 %1, -1
  store i32 %sub1, ptr %i, align 4, !tbaa !8
  ret float %sub
}

!2 = !{!3, !4, i64 0}
!3 = !{!"_ZTS1S", !4, i64 0, !7, i64 4}
!4 = !{!"float", !5, i64 0}
!5 = !{!"omnipotent char", !6, i64 0}
!6 = !{!"Simple C++ TBAA"}
!7 = !{!"int", !5, i64 0}
!8 = !{!3, !7, i64 4}

; CHECK-DAG: [[TYPE_char:!.*]] = !{!"omnipotent char", {{.*}}, i64 0}
; CHECK-DAG: [[TAG_char]] = !{[[TYPE_char]], [[TYPE_char]], i64 0}