[llvm-dev] Well-formed @llvm.lifetime.start and @llvm.lifetime.end intrinsics

Daniel Berlin via llvm-dev llvm-dev at lists.llvm.org
Thu Mar 30 15:54:23 PDT 2017


On Thu, Mar 30, 2017 at 3:45 PM, Michael Kruse <llvmdev at meinersbur.de>
wrote:

> 2017-03-31 0:19 GMT+02:00 Daniel Berlin <dberlin at dberlin.org>:
> >> I modified Polly's code generator to produce
> >>
> >>     if (c) {
> >>       llvm.lifetime.start(&var)
> >>     } else {
> >>       llvm.lifetime.start(&var)
> >>     }
> >>     [...]
> >>     llvm.lifetime.end(&var)
> >>
> >> and it does not miscompile anymore. However, Polly is currently is not
> >> able to compute the lifetime in the general case.
> >
> >
> > Of course, nothing is.
> > But they are also metadata, so you could just drop them if you wanted.
>
> This is actually exactly what Polly did, but only in the optimized
> side of the loop versioning. The original code version is not touched,
> which keeps the llvm.lifetime.start in it.
>
> So of the bug is on Polly's side, I would "fix" it by deleting all
> lifetime markers also in the original code.
>

I'm curious, btw, what made it think the above is legal.
The intrinsics are marked as touching memory, having side effects, etc.

Do you guys specially ignore them or something?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170330/2e2f21e9/attachment.html>


More information about the llvm-dev mailing list