[all-commits] [llvm/llvm-project] 42d07b: [X86] Pre-commit a test case for D110829

Jay Foad via All-commits all-commits at lists.llvm.org
Thu Oct 7 11:50:41 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 42d07bdc400f7acda912bfe889c4961b1413a6a4
      https://github.com/llvm/llvm-project/commit/42d07bdc400f7acda912bfe889c4961b1413a6a4
  Author: Jay Foad <jay.foad at amd.com>
  Date:   2021-10-07 (Thu, 07 Oct 2021)

  Changed paths:
    A llvm/test/CodeGen/X86/twoaddr-mul2.mir

  Log Message:
  -----------
  [X86] Pre-commit a test case for D110829


  Commit: 5b8befdd026d75562f127a34e0b0584820b03581
      https://github.com/llvm/llvm-project/commit/5b8befdd026d75562f127a34e0b0584820b03581
  Author: Jay Foad <jay.foad at amd.com>
  Date:   2021-10-07 (Thu, 07 Oct 2021)

  Changed paths:
    M llvm/lib/Target/X86/X86InstrInfo.cpp
    M llvm/test/CodeGen/X86/twoaddr-mul2.mir

  Log Message:
  -----------
  [X86] Special-case ADD of two identical registers in convertToThreeAddress

X86InstrInfo::convertToThreeAddress would convert this:

  %1:gr32 = ADD32rr killed %0:gr32(tied-def 0), %0:gr32, implicit-def dead $eflags

to this:

  undef %2.sub_32bit:gr64 = COPY killed %0:gr32
  undef %3.sub_32bit:gr64_nosp = COPY %0:gr32
  %1:gr32 = LEA64_32r killed %2:gr64, 1, killed %3:gr64_nosp, 0, $noreg

Note that in the ADD32rr, %0 was used twice and the first use had a kill
flag, which is what MachineInstr::addRegisterKilled does.

In the converted code, each use of %0 is copied to a new reg, and the
first COPY inherits the kill flag from the ADD32rr. This causes
machine verification to fail (if you force it to run after
TwoAddressInstructionPass) because the second COPY uses %0 after it is
killed. Note that machine verification is currently disabled after
TwoAddressInstructionPass but this is a step towards being able to
enable it.

Fix this by not inserting more than one COPY from the same source
register.

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


Compare: https://github.com/llvm/llvm-project/compare/29e00b29f76a...5b8befdd026d


More information about the All-commits mailing list