File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
SwiftCompilerSources/Sources/Optimizer/DataStructures Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -76,3 +76,21 @@ typealias BasicBlockWorklist = Worklist<BasicBlockSet>
7676typealias InstructionWorklist = Worklist < InstructionSet >
7777typealias ValueWorklist = Worklist < ValueSet >
7878typealias OperandWorklist = Worklist < OperandSet >
79+
80+ extension InstructionWorklist {
81+ mutating func pushPredecessors( of inst: Instruction , ignoring ignoreInst: SingleValueInstruction ) {
82+ if let prev = inst. previous {
83+ if prev != ignoreInst {
84+ pushIfNotVisited ( prev)
85+ }
86+ } else {
87+ for predBlock in inst. parentBlock. predecessors {
88+ let termInst = predBlock. terminator
89+ if termInst != ignoreInst {
90+ pushIfNotVisited ( termInst)
91+ }
92+ }
93+ }
94+ }
95+ }
96+
You can’t perform that action at this time.
0 commit comments