[PATCH] D91305: [Coroutine] Allocas used by StoreInst does not always escape

Xun Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 11 15:50:55 PST 2020


lxfind created this revision.
Herald added subscribers: llvm-commits, modimo, wenlei, modocache, hiraditya.
Herald added a project: LLVM.
lxfind requested review of this revision.

In the existing logic, for a given alloca, as long as its pointer value is stored into another location, it's considered as escaped.
This is a bit too conservative. Specifically, in non-optimized build mode, it's often to have patterns of code that first store an alloca somewhere and then load it right away.
These used should be handled without conservatively marking them escaped.

This patch tracks how the memory location where an alloca pointer is stored into is being used. As long as we only try to load from that location and nothing else, we can still
consider the original alloca not escaping and keep it on the stack instead of putting it on the frame.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D91305

Files:
  llvm/lib/Transforms/Coroutines/CoroFrame.cpp
  llvm/test/Transforms/Coroutines/coro-alloca-06.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91305.304674.patch
Type: text/x-patch
Size: 5818 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201111/98adbba7/attachment.bin>


More information about the llvm-commits mailing list