This is an archive of the discontinued LLVM Phabricator instance.

Account for memory locations in DIExpression::createFragmentExpression
ClosedPublic

Authored by Orlando on Oct 19 2022, 3:54 AM.

Details

Summary

createFragmentExpression rejects expressions containing certain ops, like
DW_OP_plus, that may cause the expression to compute a value that can't be
split.

Teach createFragmentExpression that the value loaded from an address computed
using those ops is safe to split.

Update a unittest to account for and test this change.

Diff Detail

Event Timeline

Orlando created this revision.Oct 19 2022, 3:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 19 2022, 3:54 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
Orlando requested review of this revision.Oct 19 2022, 3:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 19 2022, 3:54 AM

Change looks straightforward and good to me, with some comments.

llvm/lib/IR/DebugInfoMetadata.cpp
1662

There are some other operations that could be included here; DW_OP_deref_size and the xderef equivalents of both normal deref operators.

1667

Technically this would also apply to DW_OP_implicit_pointer, but not really a problem since we don't actually support that yet.

Orlando updated this revision to Diff 469186.Oct 20 2022, 5:36 AM
Orlando marked 2 inline comments as done.

Good points @StephenTozer, thanks for taking a look.

+ Add cases for:

DW_OP_deref_size
DW_OP_deref_type
DW_OP_xderef
DW_OP_xderef_size
DW_OP_xderef_type

+ Update the test.

StephenTozer accepted this revision.Oct 20 2022, 6:03 AM
StephenTozer added inline comments.
llvm/lib/IR/DebugInfoMetadata.cpp
1691

Good future-proofing!

This revision is now accepted and ready to land.Oct 20 2022, 6:03 AM