Page MenuHomePhabricator

Debug Info: Handle by-reference arguments correctly during inlining.
AbandonedPublic

Authored by aprantl on Jan 16 2015, 9:10 AM.

Details

Reviewers
dblaikie
echristo
Summary

If a function argument that is passed by reference is remapped to an alloca in the calling function, eliminate the (now) superfluous DW_OP_deref from the DIExpression.

Depends on http://reviews.llvm.org/D6986.

Diff Detail

Event Timeline

aprantl updated this revision to Diff 18304.Jan 16 2015, 9:10 AM
aprantl retitled this revision from to Debug Info: Handle by-reference arguments correctly during inlining..
aprantl updated this object.
aprantl edited the test plan for this revision. (Show Details)
aprantl added reviewers: echristo, dblaikie.
aprantl set the repository for this revision to rL LLVM.
aprantl added a subscriber: Unknown Object (MLST).
dblaikie added inline comments.Jan 16 2015, 9:55 AM
lib/Transforms/Utils/CloneFunction.cpp
291

Does createExpression need a DIBuilder? Does it just need access to a Module? (perhaps it could just be a standalone non-member function that takes a Module?)

293

So if during inlining we take a pointer and remove the indirection (eg: a function has "int *x" and "*x + 3" and its called with "int y = ...; func(&y)", etc) we drop the expression entirely? Because we can't describe the value of the pointer when there's nothing to point to, I take it? (that seems correct, just checking I understand correctly)

Is that case tested?

296

These two functions have a lot in common (everything except "getAddress/getValue") - should they be combined in some way (should DbgValueInst/DbgDeclareInst have a common "get" (address or value) for ease of access/consistency - or does that not make sense?)? If not, then at least the rest of the function could be pulled out into a common function or template if necessary)

test/DebugInfo/inline-indirect-arg.ll
4

This seems like a lot of code to test this scenario. Could this be simplified further? (I'd also expect to see some attribute((always_inline)) so you don't have to rely on the inliner to pick the right things to inline (You can compile the example with -mllvm -disable-llvm-optzns to get the bitcode before the AlwaysInliner runs (since it'll run at -O0 and a simple "clang -emit-llvm" will get you post-inlined IR, which isn't what you want)))

aprantl abandoned this revision.Dec 11 2018, 9:21 AM

I just verified that this is no longer applicable as there is no longer a DW_OP_deref in the inlined function.