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

Jonas Devlieghere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 8 11:43:40 PST 2016


JDevlieghere created this revision.
JDevlieghere added reviewers: hfinkel, reames.
JDevlieghere added subscribers: dzn, apilipenko, anna, llvm-commits.
JDevlieghere set the repository for this revision to rL LLVM.

The current capture tracking implementation always considers a store instruction to capture the given use. The example below shows a situation where this is overly pessimistic. The current implementation considers `%ptr` to be captured because it's the operand of the second store.

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

This patch adds a new capture tracker implementation called `OptimisticCaptureTracker`. It can be used through a slightly modified interface that expects alias analysis results as an additional argument. If `storeCaptures` is set to `true` or no AA is provided, the `OptimisticCaptureTracker` behaves exactly as the current `SimpleCaptureTracker`. 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.


Repository:
  rL LLVM

https://reviews.llvm.org/D27585

Files:
  include/llvm/Analysis/CaptureTracking.h
  include/llvm/Transforms/Utils/LoopUtils.h
  lib/Analysis/CaptureTracking.cpp
  lib/Transforms/Scalar/DeadStoreElimination.cpp
  lib/Transforms/Scalar/LICM.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27585.80795.patch
Type: text/x-patch
Size: 9209 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161208/d6008157/attachment.bin>


More information about the llvm-commits mailing list