This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo][InstrRef] Honour too-much-debug-info cut-outs in InstrRefBasedLDV
ClosedPublic

Authored by jmorse on Aug 10 2021, 6:46 AM.

Details

Summary

VarLoc based LiveDebugValues will abandon variable location propagation if there are too many blocks and variable assignments in the function. If it didn't, and we had (say) 1000 blocks and 1000 variables in scope, we'd end up with 1 million DBG_VALUEs just at the start of blocks.

Instruction-referencing LiveDebugValues should honour this limitation too (because the same limitation applies to it). Hoist the relevant command line options into LiveDebugValues.cpp and pass it down into the implementation classes as an argument to ExtendRanges. I've duplicated all the run-lines in live-debug-values-cutoffs.mir to have an instruction-referencing flavour.

(This limitation could be avoided eventually, for example by making LiveDebugValues an analysis that is consumed, rather than having to realise all its information into debug-info instructions).

Diff Detail

Event Timeline

jmorse created this revision.Aug 10 2021, 6:46 AM
jmorse requested review of this revision.Aug 10 2021, 6:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 10 2021, 6:46 AM
djtodoro accepted this revision.Aug 10 2021, 6:51 AM
djtodoro added a subscriber: djtodoro.

This lgtm.

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

I vote for adding an DBG output here as for the VarLocBasedLDV

LLVM_DEBUG(dbgs() << "Disabling...
This revision is now accepted and ready to land.Aug 10 2021, 6:51 AM
jmorse added inline comments.Aug 10 2021, 6:53 AM
llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
3656

Ah, good point, I'll fold that in.

This revision was landed with ongoing or failed builds.Aug 16 2021, 7:07 AM
This revision was automatically updated to reflect the committed changes.
jmorse updated this revision to Diff 366644.Aug 16 2021, 8:33 AM

Asan picked up that the early-exit I've added to InstrrefBasedLDV means that the cleanup code doesn't run, and various bits of memory don't get deallocated. It's only a small portion of code between the early-exit block and the cleanup code, so I've just wrapped it in an else condition.

Without objection I'll land this again tomorrow.

jmorse reopened this revision.Aug 16 2021, 8:33 AM
This revision is now accepted and ready to land.Aug 16 2021, 8:33 AM
djtodoro added inline comments.Aug 17 2021, 1:09 AM
llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
3658

nit: I guess the (int) casting isn't necessary here.

jmorse added inline comments.Aug 17 2021, 2:32 AM
llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
3658

Alas, there's a PPC buildbot out there running with -Werror that fails to build without this :(.

It really is an int-to-unsigned comparison, as I'm using '-1' as an error value of MaxNumBlocks earlier in the function, after which it's always positive. It's less than ideal, but shouldn't present a problem.

... although thinking about it now, it would be better to cast the signedMaxNumBlocks to unsigned, as InputBBLimit is user controlled, and they'd be surprised if a very large max-blocks-limit inverted its behaviour. I'll fold that in when landing again.

djtodoro added inline comments.Aug 17 2021, 2:37 AM
llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
3658

In the produceMLocTransferFunction() it becomes unsigned, so that is why I thought those are the same type. This is OK. :)

... although thinking about it now, it would be better to cast the signedMaxNumBlocks to unsigned, as InputBBLimit is user controlled, and they'd be surprised if a very large max-blocks-limit inverted its behaviour. I'll fold that in when landing again.

Cool, should we do a similar thing on the VarLocBasedLDV side?

This revision was landed with ongoing or failed builds.Aug 17 2021, 3:35 AM
This revision was automatically updated to reflect the committed changes.
jmorse added inline comments.Aug 17 2021, 3:36 AM
llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
3658

Cool, should we do a similar thing on the VarLocBasedLDV side?

It's all unsigned over there, shouldn't be any issues.

djtodoro added inline comments.Aug 17 2021, 3:47 AM
llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
3658

cool, thanks!