This IR pass collects the function parameters and maps them to their entry values. If parameter's value remains unchanged we can restore it original value and make it available in the debugging process. This pass introduces the using of DW_OP_LLVM_entry_value operation on IR level. Pass has been added to the default<O2> pass pipeline, right after the DeadArgumentEliminationPass.
When a function inlining happens, there is no typical parameter passing. This situation is handled by deleting calls to llvm.dbg.value instructions which describe the location of the variable as an entry value.
For understanding motivation for introducing this kind of feature, consider an example below:
extern void fn1 (); long int __attribute__((noinline)) fn2 (long int x) { fn1(); return 0; } void fn3 (){ fn2(1); }
Due to DeadArgumentEliminationPass, parameter x will be mark as undef and reported as <optimized_out> by the debugger. After applying DebugEntryValues pass, and with existence of corresponding DW_TAG_call_site_parameter, the parameter value will be available in the debugging process.
What's the motivation behind this change -- it's not covered by any of the tests changed / added, no?