From 2f55b958b1ad6f224a8cf65d6b640b8fbff78595 Mon Sep 17 00:00:00 2001 From: Gor Nishanov Date: Wed, 23 Aug 2017 14:47:52 +0000 Subject: [coroutines] CoroBegin from inner coroutines should be considered for spills Summary: If a coroutine outer calls another coroutine inner and the inner coroutine body is inlined into the outer, coro.begin from the inner coroutine should be considered for spilling if accessed across suspends. Prior to this change, coroutine frame building code was not considering any coro.begins for spilling. With this change, we only ignore coro.begin for the current coroutine, but, any coro.begins that were inlined into the current coroutine are eligible for spills. Fixes PR34267 Reviewers: GorNishanov Subscribers: qcolombet, llvm-commits, EricWF Differential Revision: https://reviews.llvm.org/D37062 llvm-svn: 311556 --- llvm/lib/Transforms/Coroutines/CoroFrame.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'llvm/lib/Transforms') diff --git a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp index 85e9003ec3c..d192fa699f3 100644 --- a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp @@ -673,8 +673,8 @@ static bool materializable(Instruction &V) { // Check for structural coroutine intrinsics that should not be spilled into // the coroutine frame. static bool isCoroutineStructureIntrinsic(Instruction &I) { - return isa(&I) || isa(&I) || - isa(&I) || isa(&I); + return isa(&I) || isa(&I) || + isa(&I); } // For every use of the value that is across suspend point, recreate that value @@ -839,7 +839,7 @@ void coro::buildCoroutineFrame(Function &F, Shape &Shape) { for (Instruction &I : instructions(F)) { // Values returned from coroutine structure intrinsics should not be part // of the Coroutine Frame. - if (isCoroutineStructureIntrinsic(I)) + if (isCoroutineStructureIntrinsic(I) || &I == Shape.CoroBegin) continue; // The Coroutine Promise always included into coroutine frame, no need to // check for suspend crossing. -- cgit v1.2.3