This is an archive of the discontinued LLVM Phabricator instance.

[SafeStack] Insert the deref before remaining elements
ClosedPublic

Authored by phosek on Jul 23 2019, 4:15 PM.

Details

Summary

This is a follow up to D64971. While we need to insert the deref after
the offset, it needs to come before the remaining elements in the
original expression since the deref needs to happen before the LLVM
fragment if present.

Diff Detail

Repository
rL LLVM

Event Timeline

phosek created this revision.Jul 23 2019, 4:15 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 23 2019, 4:15 PM
phosek updated this revision to Diff 211380.Jul 23 2019, 4:34 PM
vsk added a comment.Jul 23 2019, 4:45 PM

Mind extending debug-loc2.ll with, say, a '!DIExpression(DW_OP_deref, DW_OP_LLVM_fragment, 0, 32)' example?

llvm/lib/Transforms/Utils/Local.cpp
1601–1602

Can this whole block be replaced with: 'DIExpr = DIExpression::prepend(DIExpr, 0, Offset)'? It should handle fragments correctly and avoid inserting any extra derefs.

phosek updated this revision to Diff 211388.Jul 23 2019, 5:05 PM
phosek marked an inline comment as done.

Done

vsk accepted this revision as: vsk.Jul 23 2019, 5:07 PM

Thanks a lot, lgtm.

This revision is now accepted and ready to land.Jul 23 2019, 5:07 PM
This revision was automatically updated to reflect the committed changes.