[PATCH] D81765: Don't inline dynamic allocas that simplify to huge static allocas.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 16 14:51:21 PDT 2020


efriedma added a comment.

> It occurs to me that the lowering of static alloca is under compiler control. Maybe we shouldn't look at this as being an inlining problem, but instead look at it as being a lowering problem? If we have a static alloca which is huge and only used in a rare codepath, maybe we should be converting that to a dynamic alloca if legal for the target?

There are a few problems:

1. Figuring out the legality on top of the current IR representation of dynamic allocation and lifetimes would be painful.  If a function has any dynamic allocation, it's hard to isolate it into proper scopes.  And lifetime markers are just messy to reason about.  I have some vague ideas about rewriting the way we represent dynamic allocation to work more like ‘llvm.call.preallocated.setup, and rewriting the way we represent lifetimes, but I'm not completely sure how it would work.
2. We'd probably have to teach targets to avoid the use of a fixed "base" pointer in functions with dynamic allocation, both for performance and to avoid weird interactions with inline asm.  Probably feasible, but a substantial project.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81765





More information about the llvm-commits mailing list