[AArch64] Make stack tagging compatible with SLH
authorKristof Beyls <kristof.beyls@arm.com>
Mon, 17 Apr 2023 09:19:26 +0000 (11:19 +0200)
committerKristof Beyls <kristof.beyls@arm.com>
Thu, 20 Apr 2023 14:53:51 +0000 (16:53 +0200)
commit5e612bc291347d364f1d47c37f0d34eb6474b9b5
tree3b131868b7d02142f532a740cbac992823a56702
parent0827e2fa3fd15b49fd2d0fc676753f11abb60cab
[AArch64] Make stack tagging compatible with SLH

See https://github.com/llvm/llvm-project/issues/61830

Speculative Load Hardening (SLH) requires that conditional branches are
implemented using B.cc branches, not using {TC}B{N}Z branches.

Stack tagging was expanding one of the pseudo instructions it uses to
cbnz. This commit changes that to use b.ne instead.

Note that the added regression test was added to settag.ll rather than
speculation-hardening.ll. The speculation-hardening.ll tests also check
that all tests in the file work with global-isel. It seems that stack
tagging does not work yet with global-isel. Therefore, testing the
combination of stack tagging and SLH hard to be added to a test file
that doesn't test global-isel, i.e. settag.ll

Differential Revision: https://reviews.llvm.org/D148508
llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp
llvm/test/CodeGen/AArch64/settag-merge-order.ll
llvm/test/CodeGen/AArch64/settag-merge.ll
llvm/test/CodeGen/AArch64/settag.ll