The dbg.declare -> dbg.value conversion looks through any zext/sext to find a value to describe the variable (in the expectation that those zext/sext instruction will go away later). However, those values do not cover the entire variable and thus need a DW_OP_bit_piece.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/Transforms/Utils/Local.cpp | ||
---|---|---|
1061 | It's not clear to me that a sign/zero-extended value always indicates that the value is a subset of the variable. Is that guaranteed? Note that the Verifier checks that a piece does not cover the entire variable. | |
test/Transforms/Util/split-bit-piece.ll | ||
2 | SORA can create bit pieces, but in this case I assume it's Local that is supposed to generate the bit piece? | |
15 | Please also check for the fist argument of the dbg.value so it is clear what the assumptions about the lowering are. This will help us keeping the test useful in the future. |
lib/Transforms/Utils/Local.cpp | ||
---|---|---|
1061 | Yes, I think that's guaranteed. sext/zext guarantee that they expand from a smaller to a larger value, and if the IR was correct before, then the extended value would cover the entire variable, so this should be smaller. One case that does occur to me however, is where the expression already contains a DW_OP_bit_piece. In that case we'll have to update the existing one. | |
test/Transforms/Util/split-bit-piece.ll | ||
2 | Well, SORA calls the Local util, but I'll make the comment more clear. | |
15 | Ok. |
- Fix the case where the expression already is a bit piece
- Update comment explaining what the test is testing
- Check for the first argument of the llvm.dbg.value call
Accepted with minor comments.
lib/Transforms/Utils/Local.cpp | ||
---|---|---|
1056 | Please add a comment explaining why and why the piece has to be smaller than the variable. |
Please add a comment explaining why and why the piece has to be smaller than the variable.
Nitpick: the clang coding standards prefer full sentences as comments, with a trailing '.'.