This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo] Fix DWARF expressions for __block vars that are not on the heap
ClosedPublic

Authored by teemperor on Apr 6 2021, 4:55 AM.

Details

Summary

__block variables used to be always stored on the head instead of stack. D51564 allowed
__block variables to the stored on the stack like normal variablesif they not captured by any escaping
block, but the debug-info generation code wasn't made aware of it so we still unconditionally
emit DWARF expressions pointing to the heap.

This patch makes CGDebugInfo use the EscapingByref introduced in D51564 that tracks
whether the __block variable is actually on the heap. If it's stored on the stack instead we
just use the debug info we would generate for normal variables instead.

Diff Detail

Event Timeline

teemperor requested review of this revision.Apr 6 2021, 4:55 AM
teemperor created this revision.
ahatanak accepted this revision.Apr 6 2021, 10:38 AM

LGTM, but you can wait for the final approval from @aprantl.

Is it possible to merge the test cases into one file?

This revision is now accepted and ready to land.Apr 6 2021, 10:38 AM
aprantl accepted this revision.Apr 8 2021, 9:53 AM
aprantl added inline comments.
clang/test/CodeGen/debug-info-block-expr-noescape-func.c
10 ↗(On Diff #335480)

it would be nice to add a metadata ![[VAR:[0-9]] and then CHECK the name of the variable below.

teemperor updated this revision to Diff 345838.May 17 2021, 5:01 AM
  • Merge tests
  • Check name of associated DILocalVariable
This revision was landed with ongoing or failed builds.May 17 2021, 5:32 AM
This revision was automatically updated to reflect the committed changes.