[all-commits] [llvm/llvm-project] a246cf: [AArch64] Only create called thunks when hardening...

Anatoly Trosinenko via All-commits all-commits at lists.llvm.org
Tue Jul 2 12:53:25 PDT 2024


  Branch: refs/heads/users/atrosinenko/aarch64-sls-hardening
  Home:   https://github.com/llvm/llvm-project
  Commit: a246cfe705b326c520d6b36882a17bd90b622e5d
      https://github.com/llvm/llvm-project/commit/a246cfe705b326c520d6b36882a17bd90b622e5d
  Author: Anatoly Trosinenko <atrosinenko at accesssoftek.com>
  Date:   2024-07-02 (Tue, 02 Jul 2024)

  Changed paths:
    M llvm/lib/Target/AArch64/AArch64.h
    M llvm/lib/Target/AArch64/AArch64SLSHardening.cpp
    M llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
    M llvm/test/CodeGen/AArch64/O0-pipeline.ll
    M llvm/test/CodeGen/AArch64/O3-pipeline.ll
    M llvm/test/CodeGen/AArch64/arm64-opt-remarks-lazy-bfi.ll
    M llvm/test/CodeGen/AArch64/speculation-hardening-sls-blr-bti.mir
    M llvm/test/CodeGen/AArch64/speculation-hardening-sls-blr.mir

  Log Message:
  -----------
  [AArch64] Only create called thunks when hardening against SLS

In preparation for implementing hardening of BLRA* instructions,
restrict thunk function generation to only the thunks being actually
called from any function. As described in the existing comments,
emitting all possible thunks for BLRAA and BLRAB instructions would
mean adding about 1800 functions in total, most of which are likely
not to be called.

This commit merges AArch64SLSHardening class into SLSBLRThunkInserter,
so thunks can be created as needed while rewriting a machine function.
The usages of TII, TRI and ST fields of AArch64SLSHardening class are
replaced with requesting them in-place, as ThunkInserter assumes
multiple "entry points" in contrast to the only runOnMachineFunction
method of AArch64SLSHardening.

The runOnMachineFunction method essentially replaces pre-existing
insertThunks implementation as there is no more need to insert all
possible thunks unconditionally. Instead, thunks are created on first
use from inside of insertThunks method.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list