Page MenuHomePhabricator

[Local] Add a utility to insert replacement dbg.values, NFC
ClosedPublic

Authored by vsk on Jun 19 2018, 4:33 PM.

Details

Summary

The purpose of this utility is to make it easier for optimizations to
insert replacement dbg.values for instructions they are deleting. This
is useful in situations where salvageDebugInfo is inapplicable, say,
because the new dbg.value cannot refer to an operand of the dying value.

The utility is called insertReplacementDbgValues.

It assumes that the instruction 'From' is going to be deleted, and
inserts replacement dbg.values for each debug user of 'From'. The
newly-inserted dbg.values refer to 'To' instead of 'From'. Each
replacement dbg.value has the same location and variable as the debug
user it replaces, has a DIExpression determined by the result of
'RewriteExpr' applied to an old debug user of 'From', and is placed
before 'InsertBefore'.

This should simplify future patches, like D48331.

Diff Detail

Event Timeline

vsk created this revision.Jun 19 2018, 4:33 PM
vsk edited the summary of this revision. (Show Details)Jun 19 2018, 4:34 PM
probinson accepted this revision.Jun 20 2018, 6:50 AM
probinson added a subscriber: probinson.

Looks useful, especially given the context of the other patch. LGTM.

This revision is now accepted and ready to land.Jun 20 2018, 6:50 AM
vsk closed this revision.Jun 20 2018, 9:55 AM

Thanks for the review! Landed in rL335144.