[all-commits] [llvm/llvm-project] ec79a4: [CodeGen] precommit machine-latecleanup test

Nick Desaulniers via All-commits all-commits at lists.llvm.org
Mon May 1 21:11:50 PDT 2023


  Branch: refs/heads/release/16.x
  Home:   https://github.com/llvm/llvm-project
  Commit: ec79a47304289d9e32022e5570fe6c7efa40c59b
      https://github.com/llvm/llvm-project/commit/ec79a47304289d9e32022e5570fe6c7efa40c59b
  Author: Nick Desaulniers <ndesaulniers at google.com>
  Date:   2023-05-01 (Mon, 01 May 2023)

  Changed paths:
    A llvm/test/CodeGen/AArch64/machine-latecleanup-inlineasm.mir

  Log Message:
  -----------
  [CodeGen] precommit machine-latecleanup test

Demonstrates a hazard in machine-latecleanup.

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

(cherry picked from commit 095a0c67bb5705b2ebd91ecc039e73bbd6982cee)

[nd: remove isOutlined MIR key due to missing commit 267708f9d515
     ("[MachineOutliner] Add IsOutlined to MachineFunction")]


  Commit: e861196707993f45503621cd8472e94ddd1d8c97
      https://github.com/llvm/llvm-project/commit/e861196707993f45503621cd8472e94ddd1d8c97
  Author: Nick Desaulniers <ndesaulniers at google.com>
  Date:   2023-05-01 (Mon, 01 May 2023)

  Changed paths:
    M llvm/lib/CodeGen/MachineLateInstrsCleanup.cpp
    M llvm/test/CodeGen/AArch64/machine-latecleanup-inlineasm.mir

  Log Message:
  -----------
  [CodeGen][MachineLastInstrsCleanup] fix INLINEASM_BR hazard

If the removable definition resides in an INLINEASM_BR target, the
reuseable candidate might not dominate the INLINEASM_BR.

   bb0:
      INLINEASM_BR &"" %bb.1
      renamable $x8 = MOVi64imm 29273397577910035
      B %bb.2
      ...
    bb1:
      renamable $x8 = MOVi64imm 29273397577910035
      renamable $x8 = ADDXri killed renamable $x8, 2048, 0
    bb2:

Removing the second mov is a hazard when the inline asm branches to bb1.

Skip such replacements when the to be removed instruction is in the
target of such an INLINEASM_BR instruction.

We could get more aggressive about this in the future, but for now
simply abort.

This is causing a boot failure on linux-4.19.y branches of the LTS Linux
kernel for ARCH=arm64 with CONFIG_RANDOMIZE_BASE=y (KASLR) and
CONFIG_UNMAP_KERNEL_AT_EL0=y (KPTI).

Link: https://reviews.llvm.org/D123394
Link: https://github.com/ClangBuiltLinux/linux/issues/1837

Thanks to @nathanchance for the report, and @ardb for debugging.

Reviewed By: efriedma

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

(cherry picked from commit 012ea747ed0275c499f69c82ac0f635f4c76f746)


Compare: https://github.com/llvm/llvm-project/compare/bd6783b38076...e86119670799


More information about the All-commits mailing list