This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo][FastISel] Fix dropping dbg.value()
ClosedPublic

Authored by sdesmalen on Feb 16 2018, 7:42 AM.

Details

Summary

https://llvm.org/PR36263 shows that when compiling at -O0 a dbg.value()
instruction (that remains from an original dbg.declare()) is dropped
by FastISel. Since FastISel selects instructions by iterating a basic
block backwards, it drops the dbg.value if one of its operands is not
yet instantiated by a previously selected instruction.

Instead of calling 'lookUpRegForValue()' we can call 'getRegForValue()'
instead that will insert a placeholder for the operand to be filled in
when continuing the instruction selection.

Diff Detail

Event Timeline

sdesmalen created this revision.Feb 16 2018, 7:42 AM
sdesmalen edited the summary of this revision. (Show Details)Feb 16 2018, 7:43 AM
aprantl accepted this revision.Feb 16 2018, 8:36 AM

Nice!

test/CodeGen/Generic/dbg_value_fastisel.ll
3

It might be nice to test for something slightly more specific here.
One thing you could do is CHECK the output of llc -stop-after=livedebugvalues.

This revision is now accepted and ready to land.Feb 16 2018, 8:36 AM
sdesmalen added inline comments.Feb 16 2018, 9:27 AM
test/CodeGen/Generic/dbg_value_fastisel.ll
3

That's a good suggestion, thanks! I'll update the test to use that before I commit my patch.

This revision was automatically updated to reflect the committed changes.