[PATCH] D69889: [DebugInfo] Avoid creating entry values for clobbered registers

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 11 09:55:02 PST 2019


vsk accepted this revision.
vsk added a comment.
This revision is now accepted and ready to land.

Looks good to me.



================
Comment at: llvm/lib/CodeGen/LiveDebugValues.cpp:1380
       if (!DebugEntryVals.count(MI.getDebugVariable()))
         DebugEntryVals[MI.getDebugVariable()] = &MI;
+  }
----------------
dstenb wrote:
> vsk wrote:
> > Perhaps this is out of scope for the current patch, but: Is it possible to find no candidate entry values in the entry block, but to miss candidates in subsequent blocks? Example:
> > 
> > ```
> > define void @callee(i32 %param1) {
> > entry:
> >   ; No use of %param1 in entry block: does this imply no entry value?
> >   br label %succ
> > succ:
> >   ; Last use of %param1. We can assume it is dead after the call.
> >   call void @use(i32 %param1) 
> >   br label %succ2
> > succ2:
> >   ; No entry value location emitted for %param1?
> >   ret void
> > }
> > ```
> Testing this throughout the day, I was not able to get such a case when compiling Csmith programs at least. SelectionDAGBuilder puts some effort into placing the parameters' first DBG_VALUEs at the start of the entry block [0], so perhaps we're safe from that (or perhaps it's at least unlikely)? Other passes, e.g. PrologEpilogInserter also try to keep parameter DBG_VALUEs at the start of the entry block [1].
> 
> [0] https://github.com/llvm/llvm-project/blob/2028ae975c6aa65df3d89c10c95bf9b7baa5e0ab/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp#L5279
> [1]https://github.com/llvm/llvm-project/blob/2028ae975c6aa65df3d89c10c95bf9b7baa5e0ab/llvm/lib/CodeGen/PrologEpilogInserter.cpp#L177
Oh, interesting. Perhaps, as a follow-up, we could try asserting that we get that behavior from ISel & onwards ('if an MI outside of First_MBB is an entry value candidate, & its DIVar is not in the entry vals map, panic').


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69889/new/

https://reviews.llvm.org/D69889





More information about the llvm-commits mailing list