File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
SwiftCompilerSources/Sources/Optimizer/InstructionSimplification Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ private extension BuiltinInst {
81
81
// because memory effects are not computed in the Onone pipeline, yet.
82
82
// This is no problem because the callee (usually a global init function )is mostly very small,
83
83
// or contains the side-effect instruction `alloc_global` right at the beginning.
84
- if callee. instructions. contains ( where: { $0 . mayReadOrWriteMemory || $0 . hasUnspecifiedSideEffects } ) {
84
+ if callee. instructions. contains ( where: hasSideEffectForBuiltinOnce ) {
85
85
return
86
86
}
87
87
context. erase ( instruction: self )
@@ -133,6 +133,16 @@ private extension BuiltinInst {
133
133
}
134
134
}
135
135
136
+ private func hasSideEffectForBuiltinOnce( _ instruction: Instruction ) -> Bool {
137
+ switch instruction {
138
+ case is DebugStepInst , is DebugValueInst :
139
+ return false
140
+ default :
141
+ return instruction. mayReadOrWriteMemory ||
142
+ instruction. hasUnspecifiedSideEffects
143
+ }
144
+ }
145
+
136
146
private func typesOfValuesAreEqual( _ lhs: Value , _ rhs: Value , in function: Function ) -> Bool ? {
137
147
if lhs == rhs {
138
148
return true
Original file line number Diff line number Diff line change 274
274
%1 = global_addr @g : $*Int32
275
275
%2 = integer_literal $Builtin.Int32, 10
276
276
%3 = struct $Int32 (%2 : $Builtin.Int32)
277
+ debug_step
278
+ debug_value %1 : $*Int32
277
279
%6 = tuple ()
278
280
return %6 : $()
279
281
}
You can’t perform that action at this time.
0 commit comments