File tree Expand file tree Collapse file tree 3 files changed +42
-0
lines changed
SwiftCompilerSources/Sources/Optimizer/InstructionSimplification Expand file tree Collapse file tree 3 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ swift_compiler_sources(Optimizer
13
13
SimplifyBuiltin.swift
14
14
SimplifyCondBranch.swift
15
15
SimplifyCondFail.swift
16
+ SimplifyDebugStep.swift
16
17
SimplifyGlobalValue.swift
17
18
SimplifyStrongRetainRelease.swift
18
19
SimplifyStructExtract.swift
Original file line number Diff line number Diff line change
1
+ //===--- SimplifyDebugStep.swift ------------------------------------------===//
2
+ //
3
+ // This source file is part of the Swift.org open source project
4
+ //
5
+ // Copyright (c) 2014 - 2023 Apple Inc. and the Swift project authors
6
+ // Licensed under Apache License v2.0 with Runtime Library Exception
7
+ //
8
+ // See https://swift.org/LICENSE.txt for license information
9
+ // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10
+ //
11
+ //===----------------------------------------------------------------------===//
12
+
13
+ import SIL
14
+
15
+ extension DebugStepInst : Simplifyable {
16
+ func simplify( _ context: SimplifyContext ) {
17
+ // When compiling with optimizations (note: it's not a OnoneSimplifyable transformation),
18
+ // unconditionally remove debug_step instructions.
19
+ context. erase ( instruction: self )
20
+ }
21
+ }
22
+
Original file line number Diff line number Diff line change
1
+ // RUN: %target-sil-opt -enable-sil-verify-all %s -onone-simplification -simplify-instruction=debug_step | %FileCheck %s --check-prefix=CHECK-ONONE --check-prefix=CHECK
2
+ // RUN: %target-sil-opt -enable-sil-verify-all %s -simplification -simplify-instruction=debug_step | %FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK
3
+
4
+ // REQUIRES: swift_in_compiler
5
+
6
+ import Swift
7
+ import Builtin
8
+
9
+ // CHECK-LABEL: sil @testit
10
+ // CHECK-O-NOT: debug_step
11
+ // CHECK-ONONE: debug_step
12
+ // CHECK: } // end sil function 'testit'
13
+ sil @testit : $@convention(thin) () -> () {
14
+ bb0:
15
+ debug_step
16
+ %r = tuple ()
17
+ return %r : $()
18
+ }
19
+
You can’t perform that action at this time.
0 commit comments