[all-commits] [llvm/llvm-project] ddbf19: [Coroutines] Ignore partial lifetime markers refer...

Chuanqi Xu via All-commits all-commits at lists.llvm.org
Thu Oct 21 18:50:53 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ddbf1961941b86a61e824fb6bab1ab11f8b3ea90
      https://github.com/llvm/llvm-project/commit/ddbf1961941b86a61e824fb6bab1ab11f8b3ea90
  Author: Chuanqi Xu <yedeng.yd at linux.alibaba.com>
  Date:   2021-10-22 (Fri, 22 Oct 2021)

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

  Log Message:
  -----------
  [Coroutines] Ignore partial lifetime markers refer of an alloca

When I playing with Coroutines, I found that it is possible to generate
following IR:
```
%struct = alloca ...
%sub.element = getelementptr %struct, i64 0, i64 index ; index is not
%zero
lifetime.marker.start(%sub.element)
% use of %sub.element
lifetime.marker.end(%sub.element)
store %struct to xxx ;  %struct is escaping!

<suspend points>
```

Then the AllocaUseVisitor would collect the lifetime marker for
sub.element and treat it as the lifetime markers of the alloca! So it
judges that the alloca could be put on the stack instead of the frame by
judging the lifetime markers only.
The root cause for the bug is that AllocaUseVisitor collects wrong
lifetime markers.

This patch fixes this.

Reviewed By: lxfind

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




More information about the All-commits mailing list