mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
[Coroutines] Move CoroEarly pass to before AlwaysInliner
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 Differential Revision: https://reviews.llvm.org/D100282
This commit is contained in:
parent
86db67416f
commit
c42f8ec702
@ -179,7 +179,6 @@ bool Lowerer::lowerEarlyIntrinsics(Function &F) {
|
||||
// with a coroutine attribute.
|
||||
if (auto *CII = cast<CoroIdInst>(&I)) {
|
||||
if (CII->getInfo().isPreSplit()) {
|
||||
F.addFnAttr(CORO_PRESPLIT_ATTR, UNPREPARED_FOR_SPLIT);
|
||||
setCannotDuplicate(CII);
|
||||
CII->setCoroutineSelf();
|
||||
CoroId = cast<CoroIdInst>(&I);
|
||||
|
@ -9,7 +9,7 @@
|
||||
; CHECK: ![[PROMISEVAR_RESUME]] = !DILocalVariable(name: "__promise"
|
||||
%promise_type = type { i32, i32, double }
|
||||
|
||||
define void @f() !dbg !8 {
|
||||
define void @f() "coroutine.presplit"="0" !dbg !8 {
|
||||
entry:
|
||||
%__promise = alloca %promise_type, align 8
|
||||
%0 = bitcast %promise_type* %__promise to i8*
|
||||
|
@ -63,7 +63,7 @@
|
||||
; CHECK: ![[IVAR_RESUME]] = !DILocalVariable(name: "i"
|
||||
; CHECK: ![[JVAR_RESUME]] = !DILocalVariable(name: "j"
|
||||
; CHECK: ![[JDBGLOC_RESUME]] = !DILocation(line: 32, column: 7, scope: ![[RESUME_SCOPE]])
|
||||
define void @f() {
|
||||
define void @f() "coroutine.presplit"="0" {
|
||||
entry:
|
||||
%__promise = alloca i8, align 8
|
||||
%i = alloca i32, align 4
|
||||
|
@ -2,7 +2,7 @@
|
||||
; RUN: opt < %s -S -enable-coroutines -O2 | FileCheck %s
|
||||
; RUN: opt < %s -S -enable-coroutines -passes='default<O2>' | FileCheck %s
|
||||
|
||||
define i8* @f() {
|
||||
define i8* @f() "coroutine.presplit"="0" {
|
||||
entry:
|
||||
%id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
|
||||
%need.dyn.alloc = call i1 @llvm.coro.alloc(token %id)
|
||||
|
@ -13,7 +13,7 @@ declare i8 @llvm.coro.suspend(token, i1)
|
||||
; CHECK: call void @foo()
|
||||
; CHECK-LABEL: define {{.*}}void @foo.destroy(
|
||||
|
||||
define void @foo() {
|
||||
define void @foo() "coroutine.presplit"="0" {
|
||||
entry:
|
||||
%__promise = alloca i32, align 8
|
||||
%0 = bitcast i32* %__promise to i8*
|
||||
|
@ -2,7 +2,7 @@
|
||||
; RUN: opt < %s -enable-coroutines -O2 -preserve-alignment-assumptions-during-inlining=false -S | FileCheck %s
|
||||
; RUN: opt < %s -enable-coroutines -aa-pipeline=basic-aa -passes='default<O2>' -preserve-alignment-assumptions-during-inlining=false -S | FileCheck %s
|
||||
|
||||
define i8* @f(i32 %n) {
|
||||
define i8* @f(i32 %n) "coroutine.presplit"="0" {
|
||||
entry:
|
||||
%id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
|
||||
%size = call i32 @llvm.coro.size.i32()
|
||||
|
@ -2,7 +2,7 @@
|
||||
; RUN: opt < %s -O2 -enable-coroutines -preserve-alignment-assumptions-during-inlining=false -S | FileCheck %s
|
||||
; RUN: opt < %s -aa-pipeline=basic-aa -passes='default<O2>' -enable-coroutines -preserve-alignment-assumptions-during-inlining=false -S | FileCheck %s
|
||||
|
||||
define i8* @f(i32 %n) {
|
||||
define i8* @f(i32 %n) "coroutine.presplit"="0" {
|
||||
entry:
|
||||
%id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
|
||||
%size = call i32 @llvm.coro.size.i32()
|
||||
|
@ -2,7 +2,7 @@
|
||||
; RUN: opt < %s -O2 -enable-coroutines -S | FileCheck %s
|
||||
; RUN: opt < %s -passes='default<O2>' -enable-coroutines -S | FileCheck %s
|
||||
|
||||
define i8* @f(i32 %n) {
|
||||
define i8* @f(i32 %n) "coroutine.presplit"="0" {
|
||||
entry:
|
||||
%id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
|
||||
%need.dyn.alloc = call i1 @llvm.coro.alloc(token %id)
|
||||
|
@ -2,7 +2,7 @@
|
||||
; RUN: opt < %s -O2 -enable-coroutines -S | FileCheck %s
|
||||
; RUN: opt < %s -aa-pipeline=basic-aa -passes='default<O2>' -enable-coroutines -S | FileCheck %s
|
||||
|
||||
define i8* @f(i32 %n) {
|
||||
define i8* @f(i32 %n) "coroutine.presplit"="0" {
|
||||
entry:
|
||||
%id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
|
||||
%size = call i32 @llvm.coro.size.i32()
|
||||
|
@ -2,7 +2,7 @@
|
||||
; RUN: opt < %s -O2 -enable-coroutines -S | FileCheck %s
|
||||
; RUN: opt < %s -passes='default<O2>' -enable-coroutines -S | FileCheck %s
|
||||
|
||||
define i8* @f(i32 %n) {
|
||||
define i8* @f(i32 %n) "coroutine.presplit"="0" {
|
||||
entry:
|
||||
%promise = alloca i32
|
||||
%pv = bitcast i32* %promise to i8*
|
||||
|
@ -2,7 +2,7 @@
|
||||
; RUN: opt < %s -O2 -enable-coroutines -preserve-alignment-assumptions-during-inlining=false -S | FileCheck %s
|
||||
; RUN: opt < %s -aa-pipeline=basic-aa -passes='default<O2>' -enable-coroutines -preserve-alignment-assumptions-during-inlining=false -S | FileCheck %s
|
||||
|
||||
define i8* @f(i32 %n) {
|
||||
define i8* @f(i32 %n) "coroutine.presplit"="0" {
|
||||
entry:
|
||||
%id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
|
||||
%size = call i32 @llvm.coro.size.i32()
|
||||
|
@ -2,7 +2,7 @@
|
||||
; RUN: opt < %s -O2 -enable-coroutines -S | FileCheck %s
|
||||
; RUN: opt < %s -aa-pipeline=basic-aa -passes='default<O2>' -enable-coroutines -S | FileCheck %s
|
||||
|
||||
define i8* @f(i32 %n) {
|
||||
define i8* @f(i32 %n) "coroutine.presplit"="0" {
|
||||
entry:
|
||||
%id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
|
||||
%size = call i32 @llvm.coro.size.i32()
|
||||
|
@ -12,7 +12,7 @@
|
||||
; CHECK: CoroSplit: Processing coroutine 'f' state: 0
|
||||
; CHECK-NEXT: CoroSplit: Processing coroutine 'f' state: 1
|
||||
|
||||
define void @f() {
|
||||
define void @f() "coroutine.presplit"="0" {
|
||||
%id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
|
||||
%size = call i32 @llvm.coro.size.i32()
|
||||
%alloc = call i8* @malloc(i32 %size)
|
||||
|
Loading…
Reference in New Issue
Block a user