[all-commits] [llvm/llvm-project] b09c57: [AArch64] Add Defs=[NZCV] to MTE loop pseudos.

Simon Tatham via All-commits all-commits at lists.llvm.org
Mon Aug 21 01:17:53 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b09c575975b691e988a0f2e31d632c5f1038ab1d
      https://github.com/llvm/llvm-project/commit/b09c575975b691e988a0f2e31d632c5f1038ab1d
  Author: Simon Tatham <simon.tatham at arm.com>
  Date:   2023-08-21 (Mon, 21 Aug 2023)

  Changed paths:
    M llvm/lib/Target/AArch64/AArch64InstrInfo.td
    A llvm/test/CodeGen/AArch64/memtag-loop-nzcv.ll

  Log Message:
  -----------
  [AArch64] Add Defs=[NZCV] to MTE loop pseudos.

The `STGloop` family of pseudo-instructions all expand to a loop which
iterates over a region of memory setting all its MTE tags to a given
value. The loop writes to the flags in order to check termination. But
the unexpanded pseudo-instructions were not marked as modifying the
flags. Therefore it was possible for one to end up in a location where
the flags were live, and then the loop would corrupt them.

We spotted the effect of this in a libc++ test involving a lot of
complicated inlining, and haven't been able to construct a smaller
test case that demonstrates actual incorrect output code. So my test
here is just checking that `implicit-def $nzcv` shows up on the
pseudo-instructions as they're output from isel.

Reviewed By: DavidSpickett

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




More information about the All-commits mailing list