[all-commits] [llvm/llvm-project] ff9718: [GlobalISel] Fix legality checks for G_UBFX combines

Jay Foad via All-commits all-commits at lists.llvm.org
Sat Jan 8 01:32:53 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ff971873b3fcb8f96fdc53f0140257b2c7979ec5
      https://github.com/llvm/llvm-project/commit/ff971873b3fcb8f96fdc53f0140257b2c7979ec5
  Author: Jay Foad <jay.foad at amd.com>
  Date:   2022-01-08 (Sat, 08 Jan 2022)

  Changed paths:
    M llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
    M llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
    M llvm/test/CodeGen/AMDGPU/GlobalISel/postlegalizercombiner-ubfx.mir
    M llvm/test/CodeGen/AMDGPU/GlobalISel/ubfx.ll

  Log Message:
  -----------
  [GlobalISel] Fix legality checks for G_UBFX combines

1. Fix CombinerHelper::matchBitfieldExtractFromAnd to check legality
   with the correct types for the G_UBFX that it builds.
2. Fix AMDGPUTargetLowering::isConstantUnsignedBitfieldExtractLegal to
   match the legality rules: result and first operand can be s32 or s64
   but the "shift amount" operands are always s32.
3. Add AMDGPU tests where the post-legalizer combiner would create
   illegal MIR without the above fixes.

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


  Commit: 50fb44eebb0397f9b5f45a44239d6b53faf07c3b
      https://github.com/llvm/llvm-project/commit/50fb44eebb0397f9b5f45a44239d6b53faf07c3b
  Author: Jay Foad <jay.foad at amd.com>
  Date:   2022-01-08 (Sat, 08 Jan 2022)

  Changed paths:
    M llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
    M llvm/test/CodeGen/AMDGPU/GlobalISel/postlegalizercombiner-ubfx.mir
    M llvm/test/CodeGen/AMDGPU/GlobalISel/ubfx.ll

  Log Message:
  -----------
  [GlobalISel] Use getPreferredShiftAmountTy in one more G_UBFX combine

Change CombinerHelper::matchBitfieldExtractFromShrAnd to use
getPreferredShiftAmountTy for the shift-amount-like operands of G_UBFX
just like all the other G_[SU]BFX combines do. This better matches the
AMDGPU legality rules for these instructions.

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


Compare: https://github.com/llvm/llvm-project/compare/fb4869e26c80...50fb44eebb03


More information about the All-commits mailing list