[PATCH] ADCE: Remove debug info intrinsics in dead scopes

Adrian Prantl via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 29 12:58:42 PDT 2016


> On Mar 29, 2016, at 12:48 PM, Adrian Prantl via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> 
> 
>> On Mar 29, 2016, at 12:34 PM, Duncan P. N. Exon Smith <dexonsmith at apple.com> wrote:
>> 
>> During ADCE, track which debug info scopes still have live references
>> from the code, and delete debug info intrinsics for the dead ones.
>> 
>> These intrinsics describe the locations of variables (in registers or
>> stack slots).  If there's no code left corresponding to a variable's
>> scope, then there's no way to reference the variable in the debugger and
>> it doesn't matter what its value is.
>> 
>> I add a DEBUG printout when the described location in an SSA register,
>> in case it helps some trying to track down why locations get lost.
>> However, we still delete these; the root problem is that the scope
>> itself isn't attached to any real code.
> 
> Thanks!
> 
>> 
>> <0001-ADCE-Remove-debug-info-intrinsics-in-dead-scopes.patch>
> 
> One review comment: There should also be a testcase where the scope is in an inlined function.

Thinking of to, there should also be a negative test where the dbg intrinsic is the last remaining instruction in its scope but there is another instruction in a child-scope of the intrinsic’s scope, thus preventing the optimization from happening.

-- adrian


More information about the llvm-commits mailing list