Skip to content

Commit dfe650c

Browse files
[TBAA] Introduce test for PR96483 (NFC)
1 parent 73d862e commit dfe650c

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals
2+
; RUN: opt -passes=instcombine -S < %s | FileCheck %s
3+
4+
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
5+
6+
declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture, i64, i1) nounwind
7+
8+
%struct.T = type { %struct.Wrapper, %struct.Wrapper }
9+
%struct.Wrapper = type { i16 }
10+
11+
define void @test1(ptr %a1, ptr %a2) {
12+
; CHECK-LABEL: @test1(
13+
; CHECK-NEXT: entry:
14+
; CHECK-NEXT: [[B:%.*]] = getelementptr inbounds i8, ptr [[A2:%.*]], i64 2
15+
; CHECK-NEXT: [[TMP0:%.*]] = load i16, ptr [[A2]], align 2, !tbaa [[TBAA0:![0-9]+]]
16+
; CHECK-NEXT: store i16 [[TMP0]], ptr [[A1:%.*]], align 2, !tbaa [[TBAA0]]
17+
; CHECK-NEXT: [[B2:%.*]] = getelementptr inbounds i8, ptr [[A1]], i64 2
18+
; CHECK-NEXT: [[TMP1:%.*]] = load i16, ptr [[B]], align 2, !tbaa [[TBAA0]]
19+
; CHECK-NEXT: store i16 [[TMP1]], ptr [[B2]], align 2, !tbaa [[TBAA0]]
20+
; CHECK-NEXT: ret void
21+
;
22+
entry:
23+
%b = getelementptr inbounds i8, ptr %a2, i64 2
24+
call void @llvm.memcpy.p0.p0.i64(ptr align 2 %a1, ptr align 2 %a2, i64 2, i1 false), !tbaa !0, !tbaa.struct !6
25+
%b2 = getelementptr inbounds %struct.T, ptr %a1, i32 0, i32 1
26+
call void @llvm.memcpy.p0.p0.i64(ptr align 2 %b2, ptr align 2 %b, i64 2, i1 false), !tbaa !8, !tbaa.struct !6
27+
ret void
28+
}
29+
30+
!0 = !{!1, !4, i64 0, i64 2}
31+
!1 = !{!2, i64 4, !"_ZTS1T", !4, i64 0, i64 2, !4, i64 2, i64 2}
32+
!2 = !{!3, i64 1, !"omnipotent char"}
33+
!3 = !{!"Simple C++ TBAA"}
34+
!4 = !{!2, i64 2, !"_ZTS7Wrapper", !5, i64 0, i64 2}
35+
!5 = !{!2, i64 2, !"short"}
36+
!6 = !{i64 0, i64 2, !7}
37+
!7 = !{!5, !5, i64 0, i64 2}
38+
!8 = !{!1, !4, i64 2, i64 2}
39+
40+
;.
41+
; CHECK: [[TBAA0]] = !{[[META1:![0-9]+]], [[META1]], i64 0, i64 2}
42+
; CHECK: [[META1]] = !{[[META2:![0-9]+]], i64 2, !"short"}
43+
; CHECK: [[META2]] = !{[[META3:![0-9]+]], i64 1, !"omnipotent char"}
44+
; CHECK: [[META3]] = !{!"Simple C++ TBAA"}
45+
;.

0 commit comments

Comments
 (0)