This is an archive of the discontinued LLVM Phabricator instance.

DAG: Fix wrong legality check for ISD::FMAD
ClosedPublic

Authored by arsenm on Apr 13 2020, 9:39 AM.

Details

Summary

Since 1725f2884175ca618d29b06e35f5c6ebd618053d/D69521, this should check
isFMADLegalForFAddFSub rather than the the plain isOperationLegal.

This would assert in a subset of cases due to an oddity in how FMAD is
selected. We will allow FMA formation pre-legalize, but not FMAD even
in cases where it would be valid.

The current hook requires passing in the root fadd/fsub. However, in
this distributed case, this would be far more complicated to pass in
the relevant operand. AMDGPU doesn't get any value from the node, and
only needs the type and is the only implementor, so I'm not sure why
we have this complexity. Just rename and expand the assert to avoid
the more complicated checks spread through the distribution logic.

Diff Detail

Event Timeline

arsenm created this revision.Apr 13 2020, 9:39 AM
RKSimon accepted this revision.Apr 13 2020, 9:54 AM

LGTM

llvm/include/llvm/CodeGen/TargetLowering.h
2651

Add an assert message since we're altering it.

This revision is now accepted and ready to land.Apr 13 2020, 9:54 AM