[AArch64] NFC. Add a test exposing a bug in FixupStatepointCallerSaved pass
authorDaniil Suchkov <dsuchkov@azul.com>
Tue, 18 Jul 2023 19:57:52 +0000 (12:57 -0700)
committerDaniil Suchkov <dsuchkov@azul.com>
Tue, 18 Jul 2023 20:53:28 +0000 (13:53 -0700)
This pass doesn't take register classes into account, so it ends up
trying to spill a non-GP register onto stack which is not correct.

llvm/test/CodeGen/AArch64/aarch64-fixup-statepoint-regs-crash.ll [new file with mode: 0644]

diff --git a/llvm/test/CodeGen/AArch64/aarch64-fixup-statepoint-regs-crash.ll b/llvm/test/CodeGen/AArch64/aarch64-fixup-statepoint-regs-crash.ll
new file mode 100644 (file)
index 0000000..5dd7d40
--- /dev/null
@@ -0,0 +1,19 @@
+; XFAIL: *
+; REQUIRES: asserts
+; RUN: llc -verify-machineinstrs -max-registers-for-gc-values=256 -mtriple=aarch64-none-linux-gnu < %s
+
+define dso_local ptr addrspace(1) @foo(ptr addrspace(1) %arg) gc "statepoint-example" personality ptr null {
+  %load = load <2 x ptr addrspace(1)>, ptr addrspace(1) %arg, align 8
+  %extractelement = extractelement <2 x ptr addrspace(1)> %load, i64 0
+  %call = call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 2882400000, i32 0, ptr nonnull elementtype(void ()) @baz, i32 0, i32 0, i32 0, i32 0) [ "deopt"(ptr addrspace(1) %extractelement), "gc-live"(<2 x ptr addrspace(1)> %load) ]
+  %relocate = call coldcc <2 x ptr addrspace(1)> @llvm.experimental.gc.relocate.v2p1(token %call, i32 0, i32 0)
+  %extractelement2 = extractelement <2 x ptr addrspace(1)> %relocate, i64 0
+  ret ptr addrspace(1) %extractelement2
+}
+
+declare void @baz()
+declare token @llvm.experimental.gc.statepoint.p0(i64, i32, ptr, i32, i32, ...)
+; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
+declare <2 x ptr addrspace(1)> @llvm.experimental.gc.relocate.v2p1(token, i32, i32) #0
+
+attributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) }