Skip to content

Commit 88a7ee0

Browse files
committed
WalkUtils: avoid dynamic protocol lookup when handling enum instructions
It's simpler and faster
1 parent f0b811c commit 88a7ee0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

SwiftCompilerSources/Sources/Optimizer/Utilities/WalkUtils.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -744,9 +744,10 @@ extension AddressUseDefWalker {
744744
return walkUp(address: sea.struct, path: path.push(.structField, index: sea.fieldIndex))
745745
case let tea as TupleElementAddrInst:
746746
return walkUp(address: tea.tuple, path: path.push(.tupleField, index: tea.fieldIndex))
747-
case is InitEnumDataAddrInst, is UncheckedTakeEnumDataAddrInst:
748-
return walkUp(address: (def as! UnaryInstruction).operand.value,
749-
path: path.push(.enumCase, index: (def as! EnumInstruction).caseIndex))
747+
case let ida as InitEnumDataAddrInst:
748+
return walkUp(address: ida.operand.value, path: path.push(.enumCase, index: ida.caseIndex))
749+
case let uteda as UncheckedTakeEnumDataAddrInst:
750+
return walkUp(address: uteda.operand.value, path: path.push(.enumCase, index: uteda.caseIndex))
750751
case is InitExistentialAddrInst, is OpenExistentialAddrInst:
751752
return walkUp(address: (def as! Instruction).operands[0].value, path: path.push(.existential, index: 0))
752753
case is BeginAccessInst, is MarkUnresolvedNonCopyableValueInst:

0 commit comments

Comments
 (0)