[all-commits] [llvm/llvm-project] 8a4380: Remove TwoAddressInstructionPass::sink3AddrInstruc...

James Y Knight via All-commits all-commits at lists.llvm.org
Fri Jul 17 13:30:55 PDT 2020


  Branch: refs/heads/release/11.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 8a438096ffa48dadeb73b78844c53a7428aaec20
      https://github.com/llvm/llvm-project/commit/8a438096ffa48dadeb73b78844c53a7428aaec20
  Author: James Y Knight <jyknight at google.com>
  Date:   2020-07-17 (Fri, 17 Jul 2020)

  Changed paths:
    M llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
    A llvm/test/CodeGen/X86/callbr-asm-sink.ll
    M llvm/test/CodeGen/X86/masked-iv-unsafe.ll
    M llvm/test/CodeGen/X86/reverse_branches.ll
    M llvm/test/CodeGen/X86/rotate-extract.ll
    M llvm/test/CodeGen/X86/twoaddr-lea.ll
    R llvm/test/CodeGen/X86/twoaddr-pass-sink.ll

  Log Message:
  -----------
  Remove TwoAddressInstructionPass::sink3AddrInstruction.

This function has a bug which will incorrectly reschedule instructions
after an INLINEASM_BR (which can branch). (The bug may also allow
scheduling past a throwing-CALL, I'm not certain.)

I could fix that bug, but, as the removed FIXME notes, it's better to
attempt rescheduling before converting to 3-addr form, as that may
remove the need to convert in the first place. In fact, the code to do
such reordering was added to this pass only a few months later, in
2011, via the addition of the function rescheduleMIBelowKill. That
code does not contain the same bug.

The removal of the sink3AddrInstruction function is not a no-op: in
some cases it would move an instruction post-conversion, when
rescheduleMIBelowKill would not move the instruction pre-converison.
However, this does not appear to be important: the machine instruction
scheduler can reorder the after-conversion instructions, in any case.

This patch fixes a kernel panic 4.4 LTS x86_64 Linux kernels, when
built with clang after 4b0aa5724feaa89a9538dcab97e018110b0e4bc3.

Link: https://github.com/ClangBuiltLinux/linux/issues/1085

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

(cherry picked from commit 60433c63acb71935111304d71e41b7ee982398f8)




More information about the All-commits mailing list