[AArch64] SLSHardening: compute correct thunk name for X29.
authorKristof Beyls <kristof.beyls@arm.com>
Wed, 17 Jun 2020 09:12:40 +0000 (10:12 +0100)
committerKristof Beyls <kristof.beyls@arm.com>
Thu, 18 Jun 2020 05:36:49 +0000 (06:36 +0100)
commit3f0cc96a9694e499968544ebda6903982eaeb8a4
tree02400305dae0da7d649e69aae42d17e2795af07a
parent819948c44331c53ecc0bb1998ba1daae5c2d7275
[AArch64] SLSHardening: compute correct thunk name for X29.

The enum values for AArch64 registers are not all consecutive.
Therefore, the computation
  "__llvm_slsblr_thunk_x" + utostr(Reg - AArch64::X0)
is not always correct. utostr(Reg - AArch64::X0) will not generate the
expected string for the registers that do not have consecutive values in
the enum.
This happened to work for most registers, but does not for AArch64::FP
(i.e. register X29).
This can get triggered when the X29 is not used as a frame pointer.

Differential Revision: https://reviews.llvm.org/D81997
llvm/lib/Target/AArch64/AArch64SLSHardening.cpp
llvm/test/CodeGen/AArch64/speculation-hardening-sls.ll