[all-commits] [llvm/llvm-project] 0f3e72: AMDGPU/GlobalISel: Fix crash after mad/fma_mix fai...

petar-avramovic via All-commits all-commits at lists.llvm.org
Fri Nov 18 09:02:54 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0f3e72e86c8c7c6bf0ec24bf1e2acd74b4123e7b
      https://github.com/llvm/llvm-project/commit/0f3e72e86c8c7c6bf0ec24bf1e2acd74b4123e7b
  Author: Petar Avramovic <Petar.Avramovic at amd.com>
  Date:   2022-11-18 (Fri, 18 Nov 2022)

  Changed paths:
    M llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
    M llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.h
    M llvm/test/CodeGen/AMDGPU/GlobalISel/fma.ll

  Log Message:
  -----------
  AMDGPU/GlobalISel: Fix crash after mad/fma_mix fails selection

When selectVOP3PMadMixModsImpl fails, it can still create new copy instr
via selectVOP3ModsImpl. When selectG_FMA_FMAD gives up, new copy instr
will remain dead but will not be automatically removed.
InstructionSelect does not check if instructions created during selection
are dead.
Such dead copy doesn't have register class on dst operand and causes crash.
Fix is to build copy when operands are being added to selected instruction.

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




More information about the All-commits mailing list