[llvm-bugs] [Bug 43070] New: [coroutines] CoroSplit fails to add musttaill under -O2

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Aug 20 21:09:53 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=43070

            Bug ID: 43070
           Summary: [coroutines] CoroSplit fails to add musttaill under
                    -O2
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Transformation Utilities
          Assignee: unassignedbugs at nondot.org
          Reporter: gornishanov at gmail.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 22405
  --> https://bugs.llvm.org/attachment.cgi?id=22405&action=edit
repro of a failure to add musttail to symmetric coroutine transfer

CoroSplit.cpp:simplifyTerminatorLeadingToRet function is deficient and does not
add musttail under -O2 for this simple example (also see attached musttail.ll
reproducer).

https://godbolt.org/z/7T_YnR

// -O2 -stdlib=libc++ -std=c++2a -fstack-protector-all
// Bug#1, fails to insert musttail under -O2 (this-bug)
// Bug#2, fstack-protector-all interactions prevent tail call ([coroutines]
musttail and -fstack-protector-all interactions don't mix well)
#include <experimental/coroutine>
using namespace std::experimental;

struct coro {
  struct promise_type {
    suspend_always initial_suspend() { return {}; }
    suspend_always final_suspend() { return {}; }
    void return_void() {}
    void unhandled_exception(){}
    coro get_return_object() { return{};}
  };
};
coroutine_handle<> h;
struct sym {
  bool await_ready() { return false; }
  void await_resume() {}
  auto await_suspend(coroutine_handle<>) { return h; }
};
coro f() { co_await sym{}; }

-- 
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/20190821/c5c4ea21/attachment.html>


More information about the llvm-bugs mailing list