Skip to content

Commit 758d15a

Browse files
committed
[sil-opt] Enable sil-opt to manually enable/disable the flag StripOwnershipAfterSerialization
This is done via the flag -enable-ownership-lowering-after-diagnostics. This will let me control this option for certain sil-opt tests that are expected to always compile with/without the flag set. In most cases, I will turn it off for the test currently in tree and add an additional ownership one with this flag set. The specific test cases where this is interesting is when we are using sil-opt to simulate the diagnostics pipeline on a test containing already emitted SILGen. This will let me ensure those tests do not start failing when I flip the switch.
1 parent be47c97 commit 758d15a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tools/sil-opt/SILOpt.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ static llvm::cl::opt<bool> DisableSILOwnershipVerifier(
8181
llvm::cl::desc(
8282
"Do not verify SIL ownership invariants during SIL verification"));
8383

84+
static llvm::cl::opt<bool> EnableOwnershipLoweringAfterDiagnostics(
85+
"enable-ownership-lowering-after-diagnostics",
86+
llvm::cl::desc("Enable ownership lowering after diagnostics"),
87+
llvm::cl::init(false));
88+
8489
static llvm::cl::opt<bool>
8590
EnableSILOpaqueValues("enable-sil-opaque-values",
8691
llvm::cl::desc("Compile the module with sil-opaque-values enabled."));
@@ -333,6 +338,8 @@ int main(int argc, char **argv) {
333338
if (OptimizationGroup != OptGroup::Diagnostics)
334339
SILOpts.OptMode = OptimizationMode::ForSpeed;
335340
SILOpts.VerifySILOwnership = !DisableSILOwnershipVerifier;
341+
SILOpts.StripOwnershipAfterSerialization =
342+
EnableOwnershipLoweringAfterDiagnostics;
336343

337344
SILOpts.VerifyExclusivity = VerifyExclusivity;
338345
if (EnforceExclusivity.getNumOccurrences() != 0) {

0 commit comments

Comments
 (0)