[llvm-dev] inttoptr->add->ptrtoint capturing pointer?

Ryan Taylor via llvm-dev llvm-dev at lists.llvm.org
Thu Feb 18 07:17:07 PST 2021


I have an example:

foo(float * restrict y, int off1, int off2) {
  float * restrict x;
  for (..) {
    for (..) {
      x = y+off1;
    }
    x = (const float *)((int)x+off2))

I'm not sure why this should be capturing the pointer?

For instance, looking at scoped noalias dbg info:

SNA: Capture check for B/CSB UO:   %54 = inttoptr i32 %add83 to float*,
!dbg !101
SNA: Pointer   %1 = call float* @llvm.noalias.p0_float(float* %0, metadata
!38), !dbg !41 might be captured!

Is this implying that the noalias intrinsic might be capturing the pointer?
It doesn't look like "noalias" intrinsic has NoCapture property on the
pointer:

def int_noalias       : Intrinsic<[llvm_anyptr_ty],
                                  [LLVMMatchType<0>, llvm_metadata_ty],
                                  [IntrArgMemOnly, Returned<0>]>;

It should though right? From the definition of capture it is returning the
pointer; however, we know nothing is happening here.

I'm on llvm 10 with Hal's restrict patches.

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210218/d69f724a/attachment.html>


More information about the llvm-dev mailing list