[all-commits] [llvm/llvm-project] 61ecfc: [TwoAddressInstruction] Pre-commit a test case for...

Jay Foad via All-commits all-commits at lists.llvm.org
Fri Oct 1 12:58:11 PDT 2021


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

  Changed paths:
    A llvm/test/CodeGen/AMDGPU/twoaddr-constrain.ll

  Log Message:
  -----------
  [TwoAddressInstruction] Pre-commit a test case for D110944


  Commit: dff3454bda097723799935e8ea7f026ff0626940
      https://github.com/llvm/llvm-project/commit/dff3454bda097723799935e8ea7f026ff0626940
  Author: Jay Foad <jay.foad at amd.com>
  Date:   2021-10-01 (Fri, 01 Oct 2021)

  Changed paths:
    M llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
    M llvm/test/CodeGen/AMDGPU/twoaddr-constrain.ll

  Log Message:
  -----------
  [TwoAddressInstruction] Tweak constraining of tied operands

In collectTiedOperands, when handling an undef use that is tied to a
def, constrain the dst reg with the actual register class of the src
reg, instead of with the register class from the instructions's
MCInstrDesc. This makes a difference in some AMDGPU test cases like
this, before:

  %16:sgpr_96 = INSERT_SUBREG undef %15:sgpr_96_with_sub0_sub1(tied-def 0), killed %11:sreg_64_xexec, %subreg.sub0_sub1

After, without this patch:

  undef %16.sub0_sub1:sgpr_96 = COPY killed %11:sreg_64_xexec

This fails machine verification if you force it to run after
TwoAddressInstruction (currently it is disabled) with:

*** Bad machine code: Invalid register class for subregister index ***
- function:    s_load_constant_v3i32_align4
- basic block: %bb.0  (0xa011a88)
- instruction: undef %16.sub0_sub1:sgpr_96 = COPY killed %11:sreg_64_xexec
- operand 0:   undef %16.sub0_sub1:sgpr_96
Register class SGPR_96 does not fully support subreg index 4

After, with this patch:

  undef %16.sub0_sub1:sgpr_96_with_sub0_sub1 = COPY killed %11:sreg_64_xexec

See also svn r159120 which introduced the code to handle tied undef
uses.

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


Compare: https://github.com/llvm/llvm-project/compare/3c407196034f...dff3454bda09


More information about the All-commits mailing list