This is an archive of the discontinued LLVM Phabricator instance.

Only insert debug nodes after a phi if there is a valid insertion point
ClosedPublic

Authored by keith.walker.arm on Sep 21 2016, 7:04 AM.

Details

Summary

When adding debug information to a lowered phi node in mem2reg
check that we have a valid insertion point after the phi for adding
the debug information.

This change addresses the issue in pr30468 where a lowered phi was
added before a catchswitch and no debug information should be added
after the phi in this case.

Diff Detail

Repository
rL LLVM

Event Timeline

keith.walker.arm retitled this revision from to Only insert debug nodes after a phi if there is a valid insertion point .
keith.walker.arm updated this object.
hans edited edge metadata.Sep 21 2016, 8:37 AM

I'm not familiar with this code. I suppose it boils down to whether it's OK that ConvertDebugDeclareToDebugValue() is now best-effort instead of always inserting the dbg intrinsic. If that's the case, then lgtm.

aprantl accepted this revision.Sep 21 2016, 9:14 AM
aprantl edited edge metadata.

Given our current restrictions for the catchswitch instruction this change is LGTM.
An alternative would be to relax the requirement that a catchswitch instruction is the getFirstNonPHIOrDbg() rather than getFirstNonPHI() instruction in the block.

This revision is now accepted and ready to land.Sep 21 2016, 9:14 AM

I believe this change is good as a general back-stop check.

I will look into whether using getFirstNonPHIOrDbg() would allow us to add debug data to a catchswitch as a separate improvement.

majnemer accepted this revision.Sep 21 2016, 12:51 PM
majnemer edited edge metadata.

LGTM too.

This revision was automatically updated to reflect the committed changes.
rnk added a subscriber: rnk.Sep 27 2016, 11:53 AM

Did you forget to add the regression test for this?

rnk added a comment.Sep 27 2016, 11:55 AM

I was going to add some comments, but I implemented them instead in rL282521. PTAL