[PATCH] D73939: [AMDGPU] Fix infinite loop with fma combines

Austin Kerbow via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 3 17:46:27 PST 2020


kerbowa created this revision.
kerbowa added reviewers: arsenm, rampitec.
Herald added subscribers: llvm-commits, hiraditya, t-tye, tpr, dstuttard, yaxunl, nhaehnle, wdng, jvesely, kzhuravl.
Herald added a project: LLVM.

RFC since I'm not very familiar with the DAG
combiner.

https://reviews.llvm.org/D72312 introduced an infinite loop which involves
DAGCombiner::visitFMA and AMDGPUTargetLowering::performFNegCombine.

fma( a, fneg(b), fneg(c) ) => fneg( fma (a, b, c) ) => fma( a, fneg(b), fneg(c) ) ...

This only breaks with types where 'isFNegFree' returns flase, e.g. v4f32.
Reproducing the issue also needs the attribute 'no-signed-zeros-fp-math',
and no source mods allowed on one of the users of the Op.

This fix makes changes to indicate that it is not free to negate a fma if it
has users with source mods.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73939

Files:
  llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
  llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h
  llvm/test/CodeGen/AMDGPU/fma-combine.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73939.242238.patch
Type: text/x-patch
Size: 5218 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200204/93ddab86/attachment.bin>


More information about the llvm-commits mailing list