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

Xun Li via All-commits all-commits at lists.llvm.org
Mon Nov 16 09:15:12 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 985c524001d4dbaab17c2f59dac5f20f43695ae3
      https://github.com/llvm/llvm-project/commit/985c524001d4dbaab17c2f59dac5f20f43695ae3
  Author: Xun Li <xun at fb.com>
  Date:   2020-11-16 (Mon, 16 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