Skip to content

Commit cb1e787

Browse files
committed
EscapeAnalysis: remove unused cast handling from the main loop.
AnalyzeInstruction no longer needs to handle all these casts. getPointerBase does it now.
1 parent f009cf3 commit cb1e787

File tree

2 files changed

+1
-23
lines changed

2 files changed

+1
-23
lines changed

lib/SILOptimizer/Analysis/EscapeAnalysis.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1837,28 +1837,6 @@ void EscapeAnalysis::analyzeInstruction(SILInstruction *I,
18371837
ConGraph->setNode(TEI, ArrayElements);
18381838
return;
18391839
}
1840-
case SILInstructionKind::UncheckedRefCastInst:
1841-
case SILInstructionKind::ConvertFunctionInst:
1842-
case SILInstructionKind::UpcastInst:
1843-
case SILInstructionKind::InitExistentialRefInst:
1844-
case SILInstructionKind::OpenExistentialRefInst:
1845-
case SILInstructionKind::RawPointerToRefInst:
1846-
case SILInstructionKind::RefToRawPointerInst:
1847-
case SILInstructionKind::RefToBridgeObjectInst:
1848-
case SILInstructionKind::BridgeObjectToRefInst:
1849-
case SILInstructionKind::UncheckedAddrCastInst:
1850-
case SILInstructionKind::UnconditionalCheckedCastInst:
1851-
// DO NOT use LOADABLE_REF_STORAGE because unchecked references don't have
1852-
// retain/release instructions that trigger the 'default' case.
1853-
#define ALWAYS_OR_SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, ...) \
1854-
case SILInstructionKind::RefTo##Name##Inst: \
1855-
case SILInstructionKind::Name##ToRefInst:
1856-
#include "swift/AST/ReferenceStorage.def"
1857-
// A cast is almost like a projection.
1858-
if (CGNode *OpNode = ConGraph->getNode(I->getOperand(0))) {
1859-
ConGraph->setNode(cast<SingleValueInstruction>(I), OpNode);
1860-
}
1861-
break;
18621840
case SILInstructionKind::UncheckedRefCastAddrInst: {
18631841
auto *URCAI = cast<UncheckedRefCastAddrInst>(I);
18641842
CGNode *SrcNode = ConGraph->getNode(URCAI->getSrc());

test/SILOptimizer/unsafebufferpointer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ public func testIteration(_ p: UnsafeBufferPointer<Int>) -> Int {
1414
// Check for an optimal loop kernel
1515
// CHECK: phi
1616
// CHECK-NEXT: phi
17-
// CHECK-NEXT: getelementptr
1817
// CHECK-NEXT: bitcast
1918
// CHECK-NEXT: load
19+
// CHECK-NEXT: getelementptr
2020
// CHECK-NEXT: add
2121
// CHECK-NEXT: icmp
2222
// CHECK-NEXT: br

0 commit comments

Comments
 (0)