[PATCH] D27585: [CaptureTracking] Add optimistic capture tracker for stores

Jonas Devlieghere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 14 03:32:37 PST 2016


JDevlieghere added a comment.

In https://reviews.llvm.org/D27585#621863, @hfinkel wrote:

> > Otherwise, it only consider %ptr to escape in the previous example if it is stored to either a global or to one of the arguments of the function.
>
> I suppose this is named "optimistic" because it might return a false negative? If the pointer value is stored into some alloca then read and the read value stored into some global, then the value is captured but your analysis will return false. Is this what you intend?


Does the example below cover what you have in mind?

  @global = external global i32*
  
  define void @sample() {
  entry:
    %ptr = alloca i32
    store i32 1, i32* %ptr
    %ptrtoptr = alloca i32*
    store i32* %ptr, i32** %ptrtoptr
    %deref = load i32*, i32** %ptrtoptr
    store i32* %deref , i32** @global
    ret void
  }

If so, the escape of `%ptr` is properly detected by my change. I have a small printer pass for capture tracking which enables me to easily verify this kind of stuff. I will update my diff to include it, we can always remove it again later.


Repository:
  rL LLVM

https://reviews.llvm.org/D27585





More information about the llvm-commits mailing list