File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
SwiftCompilerSources/Sources/Optimizer/PassManager Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -79,16 +79,23 @@ extension MutatingContext {
7979 _bridged. eraseInstruction ( instruction. bridged)
8080 }
8181
82- func erase( instructionIncludingDebugUses inst: Instruction ) {
82+ func erase( instructionIncludingAllUsers inst: Instruction ) {
83+ if inst. isDeleted {
84+ return
85+ }
8386 for result in inst. results {
8487 for use in result. uses {
85- assert ( use. instruction is DebugValueInst , " instruction to delete may only have debug_value uses " )
86- erase ( instruction: use. instruction)
88+ erase ( instructionIncludingAllUsers: use. instruction)
8789 }
8890 }
8991 erase ( instruction: inst)
9092 }
9193
94+ func erase( instructionIncludingDebugUses inst: Instruction ) {
95+ precondition ( inst. results. allSatisfy { $0. uses. ignoreDebugUses. isEmpty } )
96+ erase ( instructionIncludingAllUsers: inst)
97+ }
98+
9299 func erase( block: BasicBlock ) {
93100 _bridged. eraseBlock ( block. bridged)
94101 }
You can’t perform that action at this time.
0 commit comments