[PATCH] D30307: Fix insertion of `sanitizer_cov_trace_pc_guard` insertion in optimized code with debug info

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 23 13:32:07 PST 2017


On Thu, Feb 23, 2017 at 1:23 PM Adrian Prantl <aprantl at apple.com> wrote:

>
> > On Feb 23, 2017, at 1:07 PM, Mehdi Amini <mehdi.amini at apple.com> wrote:
> >
> >
> >> On Feb 23, 2017, at 12:54 PM, Peter Collingbourne <peter at pcc.me.uk>
> wrote:
> >>
> >> On Thu, Feb 23, 2017 at 12:04 PM, Mehdi AMINI via Phabricator via
> llvm-commits <llvm-commits at lists.llvm.org> wrote:
> >> mehdi_amini created this revision.
> >> Herald added a subscriber: aprantl.
> >>
> >> It is illegal to have a call without debug info attached in a function
> >> with debug info: it'll crash the backend.
> >>
> >> Isn't that a bug in the backend? What happens if I inline a function
> compiled without debug info into a function compiled with debug info?
> >
> > See my update, this is in the verifier.
> > However I agree with you that this seems suspicious: what if LTO or
> ThinLTO make available a definition without debug info into a file with
> debug info.
> >
> > CC Adrian to clarify?
>
> - inlining a function without debug info into function with debug info and
> a location on the call site works: IIRC the inlined nodebug function will
> inherit the location of the call site. (+david who has a prepared statement
> explaining this in detail ;-)
> - inlining a function withdebug info into a function without debug info
> also works
> - it is only inlining a function with debug info into another function
> with debug info but no location on the call site that is dangerous.
>

Yep, pretty much all this. With a little nuance of "a function with debug
info" - this includes a function that may have debugloc-having instructions
in it even though the function itself doesn't have an associated subprogram.

eg: f1 calls f2 calls f3, f1 and f3 built with debug info - in that case
the call to f2 must have debug info if there's going to be inlining of f3
-> f2 -> f1.

I tried various stronger constraints back when I figured out this was a
problem, but there were cases where it seemed reasonable for a nodebug
function to be inlined into a debug-having function when the call site
didn't have a location (inlining intrinsics which have nodebug so that they
look like the code was written inline).


>
> -- adrian
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170223/bfdae1ee/attachment.html>


More information about the llvm-commits mailing list