[PATCH] D74651: Add IR constructs for inalloca replacement preallocated call setup

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 27 12:22:51 PDT 2020


aeubanks added a comment.

In D74651#2000661 <https://reviews.llvm.org/D74651#2000661>, @efriedma wrote:

> > I think if we model calls with preallocated bundles as modifying inaccessible state (i.e. the stack pointer), LLVM transforms won't do this.
>
> I don't think that's enough in general.  Well, maybe it's enough for the transforms we actually implement... LLVM currently has very few transforms that fold code together.
>
> But a simple example, suppose we had a transform that took `void g(); void f() { g();g();g();g();g(); }` and transformed it into something like `void g(); void f() { for (int i =0; i < n; ++i) g(); }`.  Looks fine generally.  If the loop body is a sequence containing calls to `llvm.call.preallocated.setup()`/`llvm.call.preallocated.arg()`, maybe not so fine.  (I think this is only an issue if there is no call actually consuming the stack; if there were, the token would block the transform.)


What about if we directly replace the `llvm.call.preallocated.arg()` with an `alloca` (as opposed to an `alloca` in the entry block)?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74651/new/

https://reviews.llvm.org/D74651





More information about the llvm-commits mailing list