This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo][6/N][InstrRef] Ignore stack-pointer clobbers on call instructions even more
ClosedPublic

Authored by jmorse on Nov 22 2021, 5:47 AM.

Details

Summary

Avoid un-necessarily recreating DBG_VALUEs on call instructions.

In LiveDebugValues, we choose to ignore any clobbers of the stack pointer by call instructions, because they're irrelevant to our model of the machine. Otherwise, SP based locations could be terminated un-necessarily. In InstrRefBasedLDV::transferRegisterDef, we correctly ignore such clobbers when updating what values are in which registers (MTracker), but we tell the block variable location tracker (TTracker) that the stack pointer has been clobbered. This caused the modified test to fail as an un-necessary DBG_VALUE was created.

This patch just corrects what we're already trying to do: as well as ignoring stack-pointer clobbers by calls for register tracking, also ignore them for variable location tracking, and don't report the clobber to TTracker.

Diff Detail

Event Timeline

jmorse created this revision.Nov 22 2021, 5:47 AM
jmorse requested review of this revision.Nov 22 2021, 5:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 22 2021, 5:48 AM
jmorse updated this revision to Diff 388941.Nov 22 2021, 9:06 AM

(Add a CHECK-NOT: line to actually ensure that this behaviour doesn't regress)

Orlando accepted this revision.Nov 24 2021, 4:36 AM

Based on our discussion in D114362, is it not worth preserving the -experimental-debug-variable-locations=false path for llvm/test/DebugInfo/X86/dbg-addr.ll? Otherwise LGTM.

llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
1358

nit: full stop removed from comment?

This revision is now accepted and ready to land.Nov 24 2021, 4:36 AM

Based on our discussion in D114362, is it not worth preserving the -experimental-debug-variable-locations=false path for llvm/test/DebugInfo/X86/dbg-addr.ll? Otherwise LGTM.

I guess so, will fold that in, cheers

This revision was landed with ongoing or failed builds.Nov 24 2021, 9:26 AM
This revision was automatically updated to reflect the committed changes.