[all-commits] [llvm/llvm-project] d08196: Merge memtag instructions with adjacent stack slots.

Evgenii Stepanov via All-commits all-commits at lists.llvm.org
Fri Jan 17 15:19:38 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: d081962dead08ef0982081e78d679dd609947ca5
      https://github.com/llvm/llvm-project/commit/d081962dead08ef0982081e78d679dd609947ca5
  Author: Evgenii Stepanov <eugenis at google.com>
  Date:   2020-01-17 (Fri, 17 Jan 2020)

  Changed paths:
    M llvm/include/llvm/CodeGen/TargetFrameLowering.h
    M llvm/lib/CodeGen/PrologEpilogInserter.cpp
    M llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp
    M llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
    M llvm/lib/Target/AArch64/AArch64FrameLowering.h
    M llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
    M llvm/lib/Target/AArch64/AArch64InstrInfo.td
    M llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp
    M llvm/lib/Target/AArch64/AArch64SelectionDAGInfo.cpp
    A llvm/test/CodeGen/AArch64/settag-merge.ll
    A llvm/test/CodeGen/AArch64/settag-merge.mir
    M llvm/test/CodeGen/AArch64/settag.ll
    M llvm/test/CodeGen/AArch64/stack-tagging-unchecked-ld-st.ll

  Log Message:
  -----------
  Merge memtag instructions with adjacent stack slots.

Summary:
Detect a run of memory tagging instructions for adjacent stack frame slots,
and replace them with a shorter instruction sequence
* replace STG + STG with ST2G
* replace STGloop + STGloop with STGloop

This code needs to run when stack slot offsets are already known, but before
FrameIndex operands in STG instructions are eliminated; that's the
reason for the new hook in PrologueEpilogue.

This change modifies STGloop and STZGloop pseudos to take the size as an
immediate integer operand, and adds _untied variants of those pseudos
that are allowed to take the base address as a FI operand. This is needed to
simplify recognizing an STGloop instruction as operating on a stack slot
post-regalloc.

This improves memtag code size by ~0.25%, and it looks like an additional ~0.1%
is possible by rearranging the stack frame such that consecutive STG
instructions reference adjacent slots (patch pending).

Reviewers: pcc, ostannard

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D70286




More information about the All-commits mailing list