[llvm-bugs] [Bug 50372] New: [Coroutine] Coroutine collect unneeded variables to coroutine frame.
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon May 17 03:34:59 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=50372
Bug ID: 50372
Summary: [Coroutine] Coroutine collect unneeded variables to
coroutine frame.
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++2a
Assignee: unassignedclangbugs at nondot.org
Reporter: yedeng.yd at linux.alibaba.com
CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk
I am not sure if it is OK to mark this with a bug. It is like a feature more to
me. I mark this with bugzilla since I found this:
https://bugs.llvm.org/show_bug.cgi?id=45566, which tells an optimization
instead of a bug.
The motivation example comes from: https://godbolt.org/z/c4zx9fE88.
The key codes is:
```
cppcoro::task<int> simple() noexcept {
// 552 byte coroutine frame
char dummy[500];
for (int i = 0;i < 500; i++)
dummy[i] = rand()%8;
consume(dummy[rand()%500]);
co_await std::experimental::suspend_always{};
co_return 10;
}
```
Here we can find that the `dummy` isn't used across suspend point. So the dummy
could show as a stack variable. If compilers could optimize this, we could get
a smaller coroutine frame.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210517/6327026b/attachment.html>
More information about the llvm-bugs
mailing list