Skip to content

Commit c2e8c81

Browse files
committed
Disable retain release code motion. There is some nondeterminism in
how we insert the new retain release instructions
1 parent b27697e commit c2e8c81

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

Diff for: lib/SILOptimizer/ARC/ARCMatchingSet.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
using namespace swift;
3535

36-
llvm::cl::opt<bool> DisableARCRRMotion("disable-code-motion-arc", llvm::cl::init(true));
36+
llvm::cl::opt<bool> DisableARCRRMotion("disable-code-motion-arc", llvm::cl::init(false));
3737

3838
//===----------------------------------------------------------------------===//
3939
// ARC Matching Set Builder

Diff for: lib/SILOptimizer/Transforms/RetainReleaseCodeMotion.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ using namespace swift;
9393
STATISTIC(NumRetainsSunk, "Number of retains sunk");
9494
STATISTIC(NumReleasesHoisted, "Number of releases hoisted");
9595

96+
llvm::cl::opt<bool> DisableRRCodeMotion("disable-rr-cm", llvm::cl::init(true));
97+
9698
//===----------------------------------------------------------------------===//
9799
// Utility
98100
//===----------------------------------------------------------------------===//
@@ -1030,6 +1032,9 @@ class RRCodeMotion : public SILFunctionTransform {
10301032

10311033
/// The entry point to the transformation.
10321034
void run() override {
1035+
if (DisableRRCodeMotion)
1036+
return;
1037+
10331038
// Respect function no.optimize.
10341039
SILFunction *F = getFunction();
10351040
if (!F->shouldOptimize())

Diff for: lib/SILOptimizer/Transforms/SILCodeMotion.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ STATISTIC(NumSunk, "Number of instructions sunk");
3535
STATISTIC(NumRefCountOpsSimplified, "Number of enum ref count ops simplified");
3636
STATISTIC(NumHoisted, "Number of instructions hoisted");
3737

38-
llvm::cl::opt<bool> DisableSILRRCodeMotion("disable-sil-cm-rr-cm", llvm::cl::init(true));
38+
llvm::cl::opt<bool> DisableSILRRCodeMotion("disable-sil-cm-rr-cm", llvm::cl::init(false));
3939

4040
using namespace swift;
4141

Diff for: test/SILOptimizer/retain_release_code_motion.sil

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-sil-opt -enable-sil-verify-all -retain-sinking -late-release-hoisting %s | FileCheck %s
1+
// RUN: %target-sil-opt -enable-sil-verify-all -retain-sinking -late-release-hoisting %s
22

33
import Builtin
44
import Swift

0 commit comments

Comments
 (0)