[all-commits] [llvm/llvm-project] fa6b54: [Coroutines] Set presplit attribute in Clang inste...

Xun Li via All-commits all-commits at lists.llvm.org
Sun Apr 18 15:41:47 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fa6b54c44ab1d5f579304eadb7ac8bd7e72d0e77
      https://github.com/llvm/llvm-project/commit/fa6b54c44ab1d5f579304eadb7ac8bd7e72d0e77
  Author: Xun Li <lxfind at gmail.com>
  Date:   2021-04-18 (Sun, 18 Apr 2021)

  Changed paths:
    M clang/lib/CodeGen/CGCoroutine.cpp
    A clang/test/CodeGenCoroutines/coro-always-inline-resume.cpp
    M clang/test/CodeGenCoroutines/coro-always-inline.cpp
    M llvm/lib/Transforms/Coroutines/CoroEarly.cpp
    M llvm/test/Transforms/Coroutines/coro-debug-O2.ll
    M llvm/test/Transforms/Coroutines/coro-debug-frame-variable.ll
    M llvm/test/Transforms/Coroutines/coro-split-01.ll
    M llvm/test/Transforms/Coroutines/coro-split-recursive.ll
    M llvm/test/Transforms/Coroutines/ex0.ll
    M llvm/test/Transforms/Coroutines/ex1.ll
    M llvm/test/Transforms/Coroutines/ex2.ll
    M llvm/test/Transforms/Coroutines/ex3.ll
    M llvm/test/Transforms/Coroutines/ex4.ll
    M llvm/test/Transforms/Coroutines/ex5.ll
    M llvm/test/Transforms/Coroutines/phi-coro-end.ll
    M llvm/test/Transforms/Coroutines/restart-trigger.ll

  Log Message:
  -----------
  [Coroutines] Set presplit attribute in Clang instead of CoroEarly pass

Presplit coroutines cannot be inlined. During AlwaysInliner we check if a function is a presplit coroutine, if so we skip inlining.
The presplit coroutine attributes are set in CoroEarly pass.
However in O0 pipeline, AlwaysInliner runs before CoroEarly, so the attribute isn't set yet and will still inline the coroutine.
This causes Clang to crash: https://bugs.llvm.org/show_bug.cgi?id=49920

To fix this, we set the attributes in the Clang front-end instead of in CoroEarly pass.

Reviewed By: rjmccall, ChuanqiXu

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




More information about the All-commits mailing list