1 ; RUN: llc -mtriple=aarch64 -mcpu=cortex-a53 < %s | FileCheck %s
3 ; Tests to check that zero stores which are generated as STP xzr, xzr aren't
4 ; scheduled incorrectly due to incorrect alias information
6 declare void @llvm.memset.p0.i64(ptr nocapture, i8, i64, i1)
7 %struct.tree_common = type { ptr, ptr, i32 }
9 ; Original test case which exhibited the bug
10 define void @test1(ptr %t, i32 %code, ptr %type) {
12 ; CHECK-DAG: stp x2, xzr, [x0, #8]
13 ; CHECK-DAG: str w1, [x0, #16]
14 ; CHECK-DAG: str xzr, [x0]
16 tail call void @llvm.memset.p0.i64(ptr align 8 %t, i8 0, i64 24, i1 false)
17 %code1 = getelementptr inbounds %struct.tree_common, ptr %t, i64 0, i32 2
18 store i32 %code, ptr %code1, align 8
19 %type2 = getelementptr inbounds %struct.tree_common, ptr %t, i64 0, i32 1
20 store ptr %type, ptr %type2, align 8
24 ; Store to each struct element instead of using memset
25 define void @test2(ptr %t, i32 %code, ptr %type) {
27 ; CHECK-DAG: str w1, [x0, #16]
28 ; CHECK-DAG: stp xzr, x2, [x0]
30 %0 = getelementptr inbounds %struct.tree_common, ptr %t, i64 0, i32 1
31 %1 = getelementptr inbounds %struct.tree_common, ptr %t, i64 0, i32 2
32 store ptr zeroinitializer, ptr %t, align 8
33 store ptr zeroinitializer, ptr %0, align 8
34 store i32 zeroinitializer, ptr %1, align 8
35 store i32 %code, ptr %1, align 8
36 store ptr %type, ptr %0, align 8
40 ; Vector store instead of memset
41 define void @test3(ptr %t, i32 %code, ptr %type) {
43 ; CHECK-DAG: stp x2, xzr, [x0, #8]
44 ; CHECK-DAG: str w1, [x0, #16]
45 ; CHECK-DAG: str xzr, [x0]
47 store <3 x i64> zeroinitializer, ptr %t, align 8
48 %code1 = getelementptr inbounds %struct.tree_common, ptr %t, i64 0, i32 2
49 store i32 %code, ptr %code1, align 8
50 %type2 = getelementptr inbounds %struct.tree_common, ptr %t, i64 0, i32 1
51 store ptr %type, ptr %type2, align 8
55 ; Vector store, then store to vector elements
56 define void @test4(ptr %p, i64 %x, i64 %y) {
58 ; CHECK-DAG: stp x2, x1, [x0, #8]
59 ; CHECK-DAG: str xzr, [x0]
61 store <3 x i64> zeroinitializer, ptr %p, align 8
62 %0 = getelementptr inbounds i64, ptr %p, i64 2
63 store i64 %x, ptr %0, align 8
64 %1 = getelementptr inbounds i64, ptr %p, i64 1
65 store i64 %y, ptr %1, align 8