Skip to content

Commit 0518ad1

Browse files
committed
Optimizer: add InstructionWorklist.pushSuccessors
1 parent 54bc9f3 commit 0518ad1

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

SwiftCompilerSources/Sources/Optimizer/DataStructures/Worklist.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,5 +93,20 @@ extension InstructionWorklist {
9393
}
9494
}
9595
}
96+
97+
mutating func pushSuccessors(of inst: Instruction, ignoring ignoreInst: Instruction) {
98+
if let succ = inst.next {
99+
if succ != ignoreInst {
100+
pushIfNotVisited(succ)
101+
}
102+
} else {
103+
for succBlock in inst.parentBlock.successors {
104+
let firstInst = succBlock.instructions.first!
105+
if firstInst != ignoreInst {
106+
pushIfNotVisited(firstInst)
107+
}
108+
}
109+
}
110+
}
96111
}
97112

0 commit comments

Comments
 (0)