[all-commits] [llvm/llvm-project] 8bc7b9: [Coroutine] Allocas used by StoreInst does not alw...

Xun Li via All-commits all-commits at lists.llvm.org
Wed Nov 11 20:54:11 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 8bc7b9278e55c4c8c731e7600a2d146438697964
      https://github.com/llvm/llvm-project/commit/8bc7b9278e55c4c8c731e7600a2d146438697964
  Author: Xun Li <xun at fb.com>
  Date:   2020-11-11 (Wed, 11 Nov 2020)

  Changed paths:
    M llvm/lib/Transforms/Coroutines/CoroFrame.cpp
    A llvm/test/Transforms/Coroutines/coro-alloca-06.ll

  Log Message:
  -----------
  [Coroutine] Allocas used by StoreInst does not always escape

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.

Differential Revision: https://reviews.llvm.org/D91305




More information about the All-commits mailing list