[PATCH] D113520: [SROA] Spill alloca's around non-capturing escapes via calls to allow alloca partitioning/promotion

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 14 05:16:00 PST 2021


lebedev.ri updated this revision to Diff 387068.
lebedev.ri added a comment.

In D113520#3129441 <https://reviews.llvm.org/D113520#3129441>, @lebedev.ri wrote:

> Introduce profitability heuristic so that the compiler doesn't take out
> the whole machine while trying to build e.g. vanilla llvm test-suite :)

Fixed the "occupancy" to only consider bytes that are both loaded and stored.
After all, we are mostly interested in allowing mem2reg,
aka, avoiding using stack instead of registers, but if not a single byte
is eligible, then we don't really care. Notably, the current check is *still*
too soft, as the last test shows.

> This results in these numbers:
> https://llvm-compile-time-tracker.com/compare.php?from=8d35c054e31e5a2bee082f7a587a660eeb24bf99&to=c7226d770b1ffa1117f724dd25de7fa2881eed18&stat=instructions
> ... and i'm not sure what is going on with `tramp3d-v4`'s `NewPM-ReleaseThinLTO` build,
> i can't reproduce the horrible slowdown locally (do i need a production debug/assert-less build?).

... and now we get https://llvm-compile-time-tracker.com/compare.php?from=2c91f48c48c42f9bd730d0791fcb19dbe0038d96&to=b4282b9b3cf6ebe17938a4041af21681b762b881&stat=instructions,
and the horrible `tramp3d-v4` regression is gone <https://llvm-compile-time-tracker.com/compare.php?from=c7226d770b1ffa1117f724dd25de7fa2881eed18&to=b4282b9b3cf6ebe17938a4041af21681b762b881&stat=instructions> :)

This is mostly the point where i'd want some feedback.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113520

Files:
  llvm/lib/Transforms/Scalar/SROA.cpp
  llvm/test/Transforms/PhaseOrdering/lifetime-sanitizer.ll
  llvm/test/Transforms/SROA/non-capturing-call.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113520.387068.patch
Type: text/x-patch
Size: 69454 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211114/8eeef3a4/attachment-0001.bin>


More information about the llvm-commits mailing list