This is an archive of the discontinued LLVM Phabricator instance.

Fix debug info for SelectionDAG legalization of DAG nodes with two results.
ClosedPublic

Authored by aprantl on Sep 14 2018, 11:44 AM.

Details

Summary

This patch fixes the debug info handling for SelectionDAG legalization of DAG nodes with two results. When an replaced SDNode has more than one result, transferDbgValues was always copying the SDDbgValue from the first result and attaching them to all members. In reality SelectionDAG::ReplaceAllUsesWith() is given an array of SDNodes (though the type signature doesn't make this obvious (cf. the call site code in ReplaceNode()).

Diff Detail

Event Timeline

aprantl created this revision.Sep 14 2018, 11:44 AM
vsk accepted this revision.Sep 14 2018, 11:50 AM

LGTM, possibly with an added assert. The test looks great!

lib/CodeGen/SelectionDAG/SelectionDAG.cpp
7793

Should we assert the first requirement here, i.e From->getNumValues() == To->getNumValues()?

This revision is now accepted and ready to land.Sep 14 2018, 11:50 AM
aprantl added inline comments.Sep 14 2018, 12:36 PM
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
7793

That's not possible, unfortunately, an SDNode can have multiple results each of which is an SDValue. We could change the function to take SmallVectorImpl instead though.

7793

I'll do that in a follow-up commit.

This revision was automatically updated to reflect the committed changes.