[all-commits] [llvm/llvm-project] e20f69: [Aarch64] Correct register class for pseudo instru...

Jameson Nash via All-commits all-commits at lists.llvm.org
Thu Sep 9 11:32:24 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e20f69f612dd678f68473e3f111ee891f7d2d108
      https://github.com/llvm/llvm-project/commit/e20f69f612dd678f68473e3f111ee891f7d2d108
  Author: Jameson Nash <vtjnash at gmail.com>
  Date:   2021-09-09 (Thu, 09 Sep 2021)

  Changed paths:
    M llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp
    M llvm/lib/Target/AArch64/AArch64InstrInfo.td
    M llvm/test/CodeGen/AArch64/GlobalISel/select-add-low.mir
    M llvm/test/CodeGen/AArch64/GlobalISel/select-blockaddress.mir
    M llvm/test/CodeGen/AArch64/GlobalISel/select-gv-with-offset.mir
    M llvm/test/CodeGen/AArch64/GlobalISel/select-jump-table-brjt-constrain.mir
    M llvm/test/CodeGen/AArch64/GlobalISel/select-jump-table-brjt.mir
    M llvm/test/CodeGen/AArch64/GlobalISel/select-static.mir
    M llvm/test/CodeGen/AArch64/GlobalISel/select.mir
    M llvm/test/CodeGen/AArch64/elim-dead-mi.mir
    M llvm/test/CodeGen/AArch64/loop-sink.mir

  Log Message:
  -----------
  [Aarch64] Correct register class for pseudo instructions

This constrains the Mov* and similar pseudo instruction to take
GPR64common register classes rather than GPR64. GPR64 includs XZR
which is invalid here, because this pseudo instructions expands
into an adrp/add pair sharing a destination register. XZR is invalid
on add and attempting to encode it will instead increment the stack
pointer causing crashes (downstream report at [1]). The test case
there reproduces on LLVM11, but I do not have a test case that
reaches this code path on main, since it is being masked by
improved dead code elimination introduced in D91513. Nevertheless,
this seems like a good thing to fix in case there are other cases
that dead code elimination doesn't clean up (e.g. if `optnone` is
used and the optimization is skipped).

I think it would be worth auditing uses of GPR64 in pseudo
instructions to see if there are any similar issues, but I do not
have a high enough view of the backend or knowledge of the
Aarch64 architecture to do this quickly.

[1] https://github.com/JuliaLang/julia/issues/39818

Reviewed By: t.p.northover

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




More information about the All-commits mailing list