[PATCH] D138044: AMDGPU/GlobalISel: Fix crash after mad/fma_mix fails selection

Petar Avramovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 15 09:55:40 PST 2022


Petar.Avramovic created this revision.
Petar.Avramovic added reviewers: sebastian-ne, Pierre-vh, foad, arsenm.
Herald added subscribers: kosarev, kerbowa, hiraditya, tpr, dstuttard, yaxunl, jvesely, kzhuravl.
Herald added a project: All.
Petar.Avramovic requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

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 first peek through selectVOP3ModsImpl and see if Src is G_FPEXT,
from here selection will succeed and we use regular selectVOP3ModsImpl.


https://reviews.llvm.org/D138044

Files:
  llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
  llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.h
  llvm/test/CodeGen/AMDGPU/GlobalISel/combine-fma-add-mul.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138044.475511.patch
Type: text/x-patch
Size: 4698 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221115/b18ed729/attachment.bin>


More information about the llvm-commits mailing list