forked from OSchip/llvm-project
[NFC] [Coroutines] Remove EnableReuseStorageInFrame option
The EnableReuseStorageInFrame option is designed for testing only. But it is better to use *_PASS_WITH_PARAMS macro to keep consistent with other passes.
This commit is contained in:
parent
d222bab672
commit
02d6845234
|
@ -589,6 +589,10 @@ Expected<bool> parseInlinerPassOptions(StringRef Params) {
|
|||
return parseSinglePassOption(Params, "only-mandatory", "InlinerPass");
|
||||
}
|
||||
|
||||
Expected<bool> parseCoroSplitPassOptions(StringRef Params) {
|
||||
return parseSinglePassOption(Params, "reuse-storage", "CoroSplitPass");
|
||||
}
|
||||
|
||||
Expected<bool> parseEarlyCSEPassOptions(StringRef Params) {
|
||||
return parseSinglePassOption(Params, "memssa", "EarlyCSE");
|
||||
}
|
||||
|
|
|
@ -171,7 +171,6 @@ CGSCC_PASS("invalidate<all>", InvalidateAllAnalysesPass())
|
|||
CGSCC_PASS("function-attrs", PostOrderFunctionAttrsPass())
|
||||
CGSCC_PASS("attributor-cgscc", AttributorCGSCCPass())
|
||||
CGSCC_PASS("openmp-opt-cgscc", OpenMPOptCGSCCPass())
|
||||
CGSCC_PASS("coro-split", CoroSplitPass())
|
||||
CGSCC_PASS("no-op-cgscc", NoOpCGSCCPass())
|
||||
#undef CGSCC_PASS
|
||||
|
||||
|
@ -185,6 +184,13 @@ CGSCC_PASS_WITH_PARAMS("inline",
|
|||
},
|
||||
parseInlinerPassOptions,
|
||||
"only-mandatory")
|
||||
CGSCC_PASS_WITH_PARAMS("coro-split",
|
||||
"CoroSplitPass",
|
||||
[](bool OptimizeFrame) {
|
||||
return CoroSplitPass(OptimizeFrame);
|
||||
},
|
||||
parseCoroSplitPassOptions,
|
||||
"reuse-storage")
|
||||
#undef CGSCC_PASS_WITH_PARAMS
|
||||
|
||||
#ifndef FUNCTION_ANALYSIS
|
||||
|
|
|
@ -45,13 +45,6 @@ using namespace llvm;
|
|||
// "coro-frame", which results in leaner debug spew.
|
||||
#define DEBUG_TYPE "coro-suspend-crossing"
|
||||
|
||||
static cl::opt<bool> EnableReuseStorageInFrame(
|
||||
"reuse-storage-in-coroutine-frame", cl::Hidden,
|
||||
cl::desc(
|
||||
"Enable the optimization which would reuse the storage in the coroutine \
|
||||
frame for allocas whose liferanges are not overlapped, for testing purposes"),
|
||||
llvm::cl::init(false));
|
||||
|
||||
enum { SmallVectorThreshold = 32 };
|
||||
|
||||
// Provides two way mapping between the blocks and numbers.
|
||||
|
@ -589,7 +582,7 @@ void FrameTypeBuilder::addFieldForAllocas(const Function &F,
|
|||
}
|
||||
});
|
||||
|
||||
if (!Shape.OptimizeFrame && !EnableReuseStorageInFrame) {
|
||||
if (!Shape.OptimizeFrame) {
|
||||
for (const auto &A : FrameData.Allocas) {
|
||||
AllocaInst *Alloca = A.Alloca;
|
||||
NonOverlapedAllocas.emplace_back(AllocaSetType(1, Alloca));
|
||||
|
@ -2567,7 +2560,7 @@ void coro::salvageDebugInfo(
|
|||
//
|
||||
// Avoid to create the alloca would be eliminated by optimization
|
||||
// passes and the corresponding dbg.declares would be invalid.
|
||||
if (!OptimizeFrame && !EnableReuseStorageInFrame)
|
||||
if (!OptimizeFrame)
|
||||
if (auto *Arg = dyn_cast<llvm::Argument>(Storage)) {
|
||||
auto &Cached = DbgPtrAllocaCache[Storage];
|
||||
if (!Cached) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; RUN: opt < %s -passes='module(coro-early),cgscc(coro-split,coro-split),function(sroa)' --reuse-storage-in-coroutine-frame -S | FileCheck %s
|
||||
; RUN: opt < %s -passes='module(coro-early),cgscc(coro-split<reuse-storage>),function(sroa)' -S | FileCheck %s
|
||||
|
||||
; Checks whether the dbg.declare for `__promise` remains valid under O2.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
; Check that we can handle spills of array allocas
|
||||
; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg,early-cse' -reuse-storage-in-coroutine-frame -S | FileCheck %s
|
||||
; RUN: opt < %s -passes='cgscc(coro-split<reuse-storage>),simplifycfg,early-cse' -S | FileCheck %s
|
||||
|
||||
%struct.big_structure = type { [500 x i8] }
|
||||
declare void @consume(%struct.big_structure*)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
; Tests that variables in a Corotuine whose lifetime range is not overlapping each other
|
||||
; re-use the same slot in Coroutine frame.
|
||||
; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg,early-cse' -reuse-storage-in-coroutine-frame -S | FileCheck %s
|
||||
; RUN: opt < %s -passes='cgscc(coro-split<reuse-storage>),simplifycfg,early-cse' -S | FileCheck %s
|
||||
%"struct.task::promise_type" = type { i8 }
|
||||
%struct.awaitable = type { i8 }
|
||||
%struct.big_structure = type { [500 x i8] }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
; Tests that variables of different type in a Corotuine whose lifetime range is not overlapping each other
|
||||
; re-use the same slot in Coroutine frame.
|
||||
; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg,early-cse' -reuse-storage-in-coroutine-frame -S | FileCheck %s
|
||||
; RUN: opt < %s -passes='cgscc(coro-split<reuse-storage>),simplifycfg,early-cse' -S | FileCheck %s
|
||||
%"struct.task::promise_type" = type { i8 }
|
||||
%struct.awaitable = type { i8 }
|
||||
%struct.big_structure = type { [500 x i8] }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
; Tests that variables of different type with incompatible alignment in a Corotuine whose lifetime
|
||||
; range is not overlapping each other should not re-use the same slot in Coroutine frame.
|
||||
; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg,early-cse' -reuse-storage-in-coroutine-frame -S | FileCheck %s
|
||||
; RUN: opt < %s -passes='cgscc(coro-split<reuse-storage>),simplifycfg,early-cse' -S | FileCheck %s
|
||||
%"struct.task::promise_type" = type { i8 }
|
||||
%struct.awaitable = type { i8 }
|
||||
%struct.big_structure = type { [500 x i8] }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
; Tests that variables of different type with incompatible alignment in a Corotuine whose
|
||||
; lifetime range is not overlapping each other re-use the same slot in CorotuineFrame.
|
||||
; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg,early-cse' -reuse-storage-in-coroutine-frame -S | FileCheck %s
|
||||
; RUN: opt < %s -passes='cgscc(coro-split<reuse-storage>),simplifycfg,early-cse' -S | FileCheck %s
|
||||
%"struct.task::promise_type" = type { i8 }
|
||||
%struct.awaitable = type { i8 }
|
||||
%struct.big_structure = type { [500 x i8] }
|
||||
|
|
Loading…
Reference in New Issue