[PATCH] D69227: [LICM] Support hosting of dynamic allocas out of loops
Artur Pilipenko via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 7 16:28:23 PST 2019
apilipenko accepted this revision.
apilipenko added inline comments.
This revision is now accepted and ready to land.
================
Comment at: lib/Transforms/Scalar/LICM.cpp:796-799
+ // TODO: This looks a lot like capture tracking, but we need to remove any
+ // invariant starts if we extend the lifetime of the alloca by hoisting it.
+ // We should probably refactor capture tracking into a form which allows us
+ // to reuse the relevant bits and remove the duplicated logic here.
----------------
This is even more restrictive. We can't let alloca be used in a phi, so this value can be observed in a different iteration.
```
for.body:
%iv = phi i64 [ %iv.next, %for.body ], [ 0, %entry ]
%p = phi i64* [ %a, %for.body ], [ %x, %entry ]
%a = alloca i64
; In the orginal program %p and %a point to different locations and don't alias
; If you hoist the alloca %p %a will point to the same memory location
%iv.next = add nuw nsw i64 %iv, 1
%exitcond = icmp ult i64 %iv, %n
br i1 %exitcond, label %for.body, label %exit
```
It would be nice to have a test like this.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D69227/new/
https://reviews.llvm.org/D69227
More information about the llvm-commits
mailing list