Author: Xun Li Date: 2021-06-28T19:28:27-07:00 New Revision: 31eb696fc4cd3b1ed8054d88af54f214c0f92989
URL: https://github.com/llvm/llvm-project/commit/31eb696fc4cd3b1ed8054d88af54f214c0f92989 DIFF: https://github.com/llvm/llvm-project/commit/31eb696fc4cd3b1ed8054d88af54f214c0f92989.diff LOG: [Coroutines] Remove CoroElide from O0 pipeline CoroElide pass works only when a post-split coroutine is inlined into another post-split coroutine. In O0, there is no inlining after CoroSplit, and hence no CoroElide can happen. It's useless to put CoroElide pass in the O0 pipeline and it will never be triggered (unless I miss anything). Differential Revision: https://reviews.llvm.org/D105066 Added: Modified: clang/test/CodeGenCoroutines/coro-newpm-pipeline.cpp llvm/lib/Passes/PassBuilder.cpp llvm/test/Transforms/Coroutines/smoketest.ll Removed: ################################################################################ diff --git a/clang/test/CodeGenCoroutines/coro-newpm-pipeline.cpp b/clang/test/CodeGenCoroutines/coro-newpm-pipeline.cpp index 83f8121296690..91e0fb3042b9d 100644 --- a/clang/test/CodeGenCoroutines/coro-newpm-pipeline.cpp +++ b/clang/test/CodeGenCoroutines/coro-newpm-pipeline.cpp @@ -3,23 +3,23 @@ // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm-bc -o /dev/null \ // RUN: -fexperimental-new-pass-manager -fdebug-pass-manager -fcoroutines-ts \ -// RUN: -O0 %s 2>&1 | FileCheck %s +// RUN: -O0 %s 2>&1 | FileCheck %s --check-prefixes=CHECK-ALL // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm-bc -o /dev/null \ // RUN: -fexperimental-new-pass-manager -fdebug-pass-manager -fcoroutines-ts \ -// RUN: -O1 %s 2>&1 | FileCheck %s +// RUN: -O1 %s 2>&1 | FileCheck %s --check-prefixes=CHECK-ALL,CHECK-OPT // -// CHECK: Running pass:{{.*}}CoroEarlyPass +// CHECK-ALL: Running pass:{{.*}}CoroEarlyPass // // The first coro-split pass enqueues a second run of the entire CGSCC pipeline. -// CHECK: Running pass: CoroSplitPass on (_Z3foov) -// CHECK: Running pass:{{.*}}CoroElidePass{{.*}} on {{.*}}_Z3foov{{.*}} +// CHECK-ALL: Running pass: CoroSplitPass on (_Z3foov) +// CHECK-OPT: Running pass:{{.*}}CoroElidePass{{.*}} on {{.*}}_Z3foov{{.*}} // // The second coro-split pass splits coroutine 'foo' into funclets // 'foo.resume', 'foo.destroy', and 'foo.cleanup'. -// CHECK: Running pass: CoroSplitPass on (_Z3foov) -// CHECK: Running pass:{{.*}}CoroElidePass{{.*}} on {{.*}}_Z3foov{{.*}} +// CHECK-ALL: Running pass: CoroSplitPass on (_Z3foov) +// CHECK-OPT: Running pass:{{.*}}CoroElidePass{{.*}} on {{.*}}_Z3foov{{.*}} // -// CHECK: Running pass:{{.*}}CoroCleanupPass +// CHECK-ALL: Running pass:{{.*}}CoroCleanupPass namespace std { namespace experimental { diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp index 49f6c1049625f..2db8b451bf16d 100644 --- a/llvm/lib/Passes/PassBuilder.cpp +++ b/llvm/lib/Passes/PassBuilder.cpp @@ -1986,7 +1986,6 @@ ModulePassManager PassBuilder::buildO0DefaultPipeline(OptimizationLevel Level, CGSCCPassManager CGPM; CGPM.addPass(CoroSplitPass()); - CGPM.addPass(createCGSCCToFunctionPassAdaptor(CoroElidePass())); MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(std::move(CGPM))); MPM.addPass(createModuleToFunctionPassAdaptor(CoroCleanupPass())); diff --git a/llvm/test/Transforms/Coroutines/smoketest.ll b/llvm/test/Transforms/Coroutines/smoketest.ll index bb8d26783ca9d..bd122ff00180c 100644 --- a/llvm/test/Transforms/Coroutines/smoketest.ll +++ b/llvm/test/Transforms/Coroutines/smoketest.ll @@ -2,21 +2,21 @@ ; levels and -enable-coroutines adds coroutine passes to the pipeline. ; ; RUN: opt < %s -disable-output -passes='default<O0>' -enable-coroutines \ -; RUN: -debug-pass-manager 2>&1 | FileCheck %s +; RUN: -debug-pass-manager 2>&1 | FileCheck %s --check-prefixes=CHECK-ALL ; RUN: opt < %s -disable-output -passes='default<O1>' -enable-coroutines \ -; RUN: -debug-pass-manager 2>&1 | FileCheck %s +; RUN: -debug-pass-manager 2>&1 | FileCheck %s --check-prefixes=CHECK-ALL,CHECK-OPT ; RUN: opt < %s -disable-output -passes='default<O2>' -enable-coroutines \ -; RUN: -debug-pass-manager 2>&1 | FileCheck %s +; RUN: -debug-pass-manager 2>&1 | FileCheck %s --check-prefixes=CHECK-ALL,CHECK-OPT ; RUN: opt < %s -disable-output -passes='default<O3>' -enable-coroutines \ -; RUN: -debug-pass-manager 2>&1 | FileCheck %s +; RUN: -debug-pass-manager 2>&1 | FileCheck %s --check-prefixes=CHECK-ALL,CHECK-OPT ; RUN: opt < %s -disable-output -debug-pass-manager \ ; RUN: -passes='function(coro-early),cgscc(coro-split),function(coro-elide,coro-cleanup)' 2>&1 \ -; RUN: | FileCheck %s +; RUN: | FileCheck %s --check-prefixes=CHECK-ALL,CHECK-OPT -; CHECK: CoroEarlyPass -; CHECK: CoroSplitPass -; CHECK: CoroElidePass -; CHECK: CoroCleanupPass +; CHECK-ALL: CoroEarlyPass +; CHECK-ALL: CoroSplitPass +; CHECK-OPT: CoroElidePass +; CHECK-ALL: CoroCleanupPass define void @foo() { ret void _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits