This is an archive of the discontinued LLVM Phabricator instance.

[ISel] Fix DAG divergence after new FMA combine
ClosedPublic

Authored by foad on Sep 28 2022, 7:35 AM.

Details

Summary

D132837 introduced a new DAG combine that used MorphNodeTo to morph an
FMUL into an FMA. It turns out that MorphNodeTo does not properly update
the divergence bit for users of the morphed node, causing an assertion
failure on the new test case:

llc: SelectionDAG.cpp:10486: void llvm::SelectionDAG::VerifyDAGDivergence(): Assertion `calculateDivergence(N) == N->isDivergent() && "Divergence bit inconsistency detected"' failed.

Fixing MorphNodeTo to propagate the divergence bit is tricky because of
the way it is used to select machine instructions, so use getNode and
ReplaceAllUsesOfValueWith instead.

Diff Detail

Event Timeline

foad created this revision.Sep 28 2022, 7:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 28 2022, 7:35 AM
foad requested review of this revision.Sep 28 2022, 7:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 28 2022, 7:35 AM
rampitec accepted this revision.Sep 28 2022, 9:55 AM
This revision is now accepted and ready to land.Sep 28 2022, 9:55 AM
tsymalla accepted this revision.Sep 28 2022, 10:20 AM
This revision was landed with ongoing or failed builds.Sep 28 2022, 11:44 AM
This revision was automatically updated to reflect the committed changes.