[all-commits] [llvm/llvm-project] 33374c: [CFIFixup] Allow function prologues to span more t...

Momchil Velikov via All-commits all-commits at lists.llvm.org
Tue Nov 14 07:02:17 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 33374c445d31bfe5b8c638900a09e85d5bc409ee
      https://github.com/llvm/llvm-project/commit/33374c445d31bfe5b8c638900a09e85d5bc409ee
  Author: Momchil Velikov <momchil.velikov at arm.com>
  Date:   2023-11-14 (Tue, 14 Nov 2023)

  Changed paths:
    M llvm/lib/CodeGen/CFIFixup.cpp
    M llvm/test/CodeGen/AArch64/cfi-fixup-multi-block-prologue.mir

  Log Message:
  -----------
  [CFIFixup] Allow function prologues to span more than one basic block (#68984)

The CFIFixup pass assumes a function prologue is contained in a single
basic block. This assumption is broken with upcoming support for stack
probing (`-fstack-clash-protection`) in AArch64 - the emitted probing
sequence in a prologue may contain loops, i.e. more than one basic
block. The generated CFG is not arbitrary though:
 * CFI instructions are outside of any loops
* for any two CFI instructions of the function prologue one dominates
and is post-dominated by the other

Thus, for the prologue CFI instructions, if one is executed then all are
executed, there is a total order of executions, and the last instruction
in that order can be considered the end of the prologoue for the purpose
of inserting the initial `.cfi_remember_state` directive.

That last instruction is found by finding the first block in the
post-order traversal which contains prologue CFI instructions.




More information about the All-commits mailing list