68 lines · plain
1; RUN: llc -mtriple=aarch64 -mcpu=cortex-a53 < %s | FileCheck %s2 3; Tests to check that zero stores which are generated as STP xzr, xzr aren't4; scheduled incorrectly due to incorrect alias information5 6declare void @llvm.memset.p0.i64(ptr nocapture, i8, i64, i1)7%struct.tree_common = type { ptr, ptr, i32 }8 9; Original test case which exhibited the bug10define void @test1(ptr %t, i32 %code, ptr %type) {11; CHECK-LABEL: test1:12; CHECK-DAG: stp x2, xzr, [x0, #8]13; CHECK-DAG: str w1, [x0, #16]14; CHECK-DAG: str xzr, [x0]15entry: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 218 store i32 %code, ptr %code1, align 819 %type2 = getelementptr inbounds %struct.tree_common, ptr %t, i64 0, i32 120 store ptr %type, ptr %type2, align 821 ret void22}23 24; Store to each struct element instead of using memset25define void @test2(ptr %t, i32 %code, ptr %type) {26; CHECK-LABEL: test2:27; CHECK-DAG: str w1, [x0, #16]28; CHECK-DAG: stp xzr, x2, [x0]29entry:30 %0 = getelementptr inbounds %struct.tree_common, ptr %t, i64 0, i32 131 %1 = getelementptr inbounds %struct.tree_common, ptr %t, i64 0, i32 232 store ptr zeroinitializer, ptr %t, align 833 store ptr zeroinitializer, ptr %0, align 834 store i32 zeroinitializer, ptr %1, align 835 store i32 %code, ptr %1, align 836 store ptr %type, ptr %0, align 837 ret void38}39 40; Vector store instead of memset41define void @test3(ptr %t, i32 %code, ptr %type) {42; CHECK-LABEL: test3:43; CHECK-DAG: stp x2, xzr, [x0, #8]44; CHECK-DAG: str w1, [x0, #16]45; CHECK-DAG: str xzr, [x0]46entry:47 store <3 x i64> zeroinitializer, ptr %t, align 848 %code1 = getelementptr inbounds %struct.tree_common, ptr %t, i64 0, i32 249 store i32 %code, ptr %code1, align 850 %type2 = getelementptr inbounds %struct.tree_common, ptr %t, i64 0, i32 151 store ptr %type, ptr %type2, align 852 ret void53}54 55; Vector store, then store to vector elements56define void @test4(ptr %p, i64 %x, i64 %y) {57; CHECK-LABEL: test4:58; CHECK-DAG: stp x2, x1, [x0, #8]59; CHECK-DAG: str xzr, [x0]60entry:61 store <3 x i64> zeroinitializer, ptr %p, align 862 %0 = getelementptr inbounds i64, ptr %p, i64 263 store i64 %x, ptr %0, align 864 %1 = getelementptr inbounds i64, ptr %p, i64 165 store i64 %y, ptr %1, align 866 ret void67}68