Skip to content

Commit b258865

Browse files
Merge pull request #41478 from nate-chandler/lexical_lifetimes/destroy-hoisting/disable
[SILOpt] Disabled DestroyHoisting.
2 parents 9a9f796 + 979196c commit b258865

File tree

9 files changed

+19
-19
lines changed

9 files changed

+19
-19
lines changed

benchmark/single-source/SubstringTest.swift

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,23 @@ public func run_SubstringFromLongStringGeneric(_ n: Int) {
6363
}
6464
}
6565

66-
@inline(never)
67-
public func run_StringFromLongWholeSubstring(_ n: Int) {
66+
private func getLongWideRealBuffer() -> String {
6867
var s0 = longWide
6968
s0 += "!" // ensure the string has a real buffer
70-
let s = Substring(s0)
69+
return s0
70+
}
71+
72+
@inline(never)
73+
public func run_StringFromLongWholeSubstring(_ n: Int) {
74+
let s = Substring(getLongWideRealBuffer())
7175
for _ in 1...n*500 {
7276
blackHole(String(s))
7377
}
7478
}
7579

7680
@inline(never)
7781
public func run_StringFromLongWholeSubstringGeneric(_ n: Int) {
78-
var s0 = longWide
79-
s0 += "!" // ensure the string has a real buffer
80-
let s = Substring(s0)
82+
let s = Substring(getLongWideRealBuffer())
8183
for _ in 1...n*500 {
8284
create(String.self, from: s)
8385
}

lib/SILOptimizer/PassManager/PassPipeline.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ llvm::cl::opt<bool> SILDisableLateOMEByDefault(
6767
"Disable late OME for non-transparent functions by default"));
6868

6969
llvm::cl::opt<bool>
70-
EnableDestroyHoisting("enable-destroy-hoisting", llvm::cl::init(true),
70+
EnableDestroyHoisting("enable-destroy-hoisting", llvm::cl::init(false),
7171
llvm::cl::desc("Enable the DestroyHoisting pass."));
7272

7373
//===----------------------------------------------------------------------===//

lib/SILOptimizer/Transforms/SSADestroyHoisting.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ class DeinitBarriers {
210210
// sure not to hoist a destroy_addr into an access scope and by doing so cause
211211
// a deinit which had previously executed outside an access scope to start
212212
// executing within it--that could violate exclusivity.
213-
llvm::SmallPtrSet<BeginAccessInst *, 8> barrierAccessScopes;
213+
SmallPtrSet<BeginAccessInst *, 8> barrierAccessScopes;
214214

215215
explicit DeinitBarriers(bool ignoreDeinitBarriers,
216216
const KnownStorageUses &knownUses,

test/SILOptimizer/assemblyvision_remark/chacha.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ public func run_ChaCha(_ N: Int) {
3232

3333
var checkedtext = Array(repeating: UInt8(0), count: 1024)
3434
ChaCha20.encrypt(bytes: &checkedtext, key: key, nonce: nonce)
35-
checkResult(checkedtext) // expected-remark {{release of type '}}
36-
// expected-note @-3 {{of 'checkedtext}}
35+
checkResult(checkedtext)// expected-note @-2 {{of 'checkedtext}}
36+
3737

3838
var plaintext = Array(repeating: UInt8(0), count: 30720)
3939
for _ in 1...N {
@@ -47,3 +47,4 @@ public func run_ChaCha(_ N: Int) {
4747
// expected-note @-16 {{of 'nonce}}
4848
// expected-remark @-4 {{release of type '}}
4949
// expected-note @-19 {{of 'key}}
50+
// expected-remark @-6 {{release of type '}}

test/SILOptimizer/enum_payload_modification_opt.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// RUN: %target-run %t/a.out | %FileCheck %s
44

55
// REQUIRES: executable_test,swift_stdlib_no_asserts,optimized_stdlib
6+
// REQUIRES: rdar89260664
67

78
final class Storage {
89
var v : Int

test/SILOptimizer/hoist_destroy_addr.sil

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,12 +350,12 @@ exit:
350350

351351
// Hoist a destroy_addr of an @in argument over a load from an alloc_stack.
352352
//
353-
// CHECK-LABEL: sil [ossa] @test_hoist_over_load_from_stack : {{.*}} {
353+
// CHECK-LABEL: sil [ossa] @hoist_over_load_from_stack : {{.*}} {
354354
// CHECK: apply
355355
// CHECK: destroy_addr
356356
// CHECK: load [take]
357-
// CHECK-LABEL: } // end sil function 'test_hoist_over_load_from_stack'
358-
sil [ossa] @test_hoist_over_load_from_stack : $@convention(thin) (@in X) -> @owned X {
357+
// CHECK-LABEL: } // end sil function 'hoist_over_load_from_stack'
358+
sil [ossa] @hoist_over_load_from_stack : $@convention(thin) (@in X) -> @owned X {
359359
entry(%in_addr : $*X):
360360
%stack_addr = alloc_stack $X
361361
copy_addr %in_addr to [initialization] %stack_addr : $*X

test/SILOptimizer/pointer_conversion.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,9 @@ public func testMutableArray() {
5858
// CHECK: [[POINTER:%.+]] = struct $UnsafeMutableRawPointer (
5959
// CHECK-NEXT: [[DEP_POINTER:%.+]] = mark_dependence [[POINTER]] : $UnsafeMutableRawPointer on {{.*}} : $__ContiguousArrayStorageBase
6060
// CHECK: [[FN:%.+]] = function_ref @takesMutableRawPointer
61-
// CHECK: strong_retain {{%.+}} : ${{Builtin[.]BridgeObject|__ContiguousArrayStorageBase}}
6261
// CHECK: apply [[FN]]([[DEP_POINTER]])
6362
// CHECK-NOT: {{^bb[0-9]+:}}
6463
// CHECK: strong_release {{%.+}} : ${{Builtin[.]BridgeObject|__ContiguousArrayStorageBase}}
65-
// CHECK: strong_release {{%.+}} : ${{Builtin[.]BridgeObject|__ContiguousArrayStorageBase}}
6664
// CHECK: dealloc_stack {{%.+}} : $*Array<Int>
6765
// CHECK-NEXT: [[EMPTY:%.+]] = tuple ()
6866
// CHECK-NEXT: return [[EMPTY]]
@@ -76,11 +74,9 @@ public func testMutableArrayToOptional() {
7674
// CHECK-NEXT: [[DEP_POINTER:%.+]] = mark_dependence [[POINTER]] : $UnsafeMutableRawPointer on {{.*}} : $__ContiguousArrayStorageBase
7775
// CHECK-NEXT: [[OPT_POINTER:%.+]] = enum $Optional<UnsafeMutableRawPointer>, #Optional.some!enumelt, [[DEP_POINTER]]
7876
// CHECK: [[FN:%.+]] = function_ref @takesOptMutableRawPointer
79-
// CHECK: strong_retain {{%.+}} : ${{Builtin[.]BridgeObject|__ContiguousArrayStorageBase}}
8077
// CHECK: apply [[FN]]([[OPT_POINTER]])
8178
// CHECK-NOT: {{^bb[0-9]+:}}
8279
// CHECK: strong_release {{%.+}} : ${{Builtin[.]BridgeObject|__ContiguousArrayStorageBase}}
83-
// CHECK: strong_release {{%.+}} : ${{Builtin[.]BridgeObject|__ContiguousArrayStorageBase}}
8480
// CHECK: dealloc_stack {{%.+}} : $*Array<Int>
8581
// CHECK-NEXT: [[EMPTY:%.+]] = tuple ()
8682
// CHECK-NEXT: return [[EMPTY]]

test/SILOptimizer/templvalueopt.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -module-name=test -O -emit-sil %s | %FileCheck %s
1+
// RUN: %target-swift-frontend -module-name=test -O -enable-ossa-modules -emit-sil %s | %FileCheck %s
22

33
// RUN: %empty-directory(%t)
44
// RUN: %target-build-swift -O -module-name=test %s -o %t/a.out

validation-test/SILOptimizer/lexical-lifetimes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-run-simple-swift(-Xfrontend -disable-availability-checking -parse-as-library -Xfrontend -enable-copy-propagation -Xllvm -enable-destroy-hoisting=false) | %FileCheck %s
1+
// RUN: %target-run-simple-swift(-Xfrontend -disable-availability-checking -parse-as-library -Xfrontend -enable-copy-propagation) | %FileCheck %s
22

33
// REQUIRES: executable_test
44
// REQUIRES: concurrency

0 commit comments

Comments
 (0)