Skip to content

Commit 32e1de6

Browse files
committed
---
yaml --- r: 286655 b: refs/heads/master-next c: 6966f12 h: refs/heads/master i: 286653: b874c38 286651: f9f114f 286647: 6109041 286639: 5a51dfc 286623: 0de1790 286591: f358a22
1 parent c47426f commit 32e1de6

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: a67ffadd758dfc7a0f10a8afde063b8864663208
3-
refs/heads/master-next: 8cb4456d337f99dea8bca08901c8b554f1e65d58
3+
refs/heads/master-next: 6966f12f9e91dc3d5d675ec1b209aa2d3f27e971
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea
66
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-b: 66d897bfcf64a82cb9a87f5e663d889189d06d07

branches/master-next/lib/SILOptimizer/Transforms/SpecializeOpaqueArchetypes.cpp

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,18 +133,30 @@ class OpaqueSpecializerCloner
133133
void visitEnumInst(EnumInst *Inst) {
134134
getBuilder().setCurrentDebugScope(getOpScope(Inst->getDebugScope()));
135135
SILValue opd = SILValue();
136+
auto newTy = getOpType(Inst->getType());
136137
if (Inst->hasOperand()) {
137-
SILType caseTy = Inst->getType().getEnumElementType(
138-
Inst->getElement(), getBuilder().getFunction().getModule());
139138
opd = getOpValue(Inst->getOperand());
140-
if (opd->getType() != caseTy) {
141-
opd = createCast(getOpLocation(Inst->getLoc()), opd, caseTy);
142-
}
139+
SILType newCaseTy = newTy.getEnumElementType(
140+
Inst->getElement(), getBuilder().getFunction().getModule());
141+
if (opd->getType() != newCaseTy)
142+
opd = createCast(getOpLocation(Inst->getLoc()), opd, newCaseTy);
143143
}
144144
recordClonedInstruction(
145145
Inst, getBuilder().createEnum(getOpLocation(Inst->getLoc()), opd,
146-
Inst->getElement(),
147-
getOpType(Inst->getType())));
146+
Inst->getElement(), newTy));
147+
}
148+
149+
void visitInitEnumDataAddrInst(InitEnumDataAddrInst *Inst) {
150+
getBuilder().setCurrentDebugScope(getOpScope(Inst->getDebugScope()));
151+
auto opd = getOpValue(Inst->getOperand());
152+
auto caseTy = opd->getType().getEnumElementType(
153+
Inst->getElement(), getBuilder().getFunction().getModule());
154+
auto expectedTy = getOpType(Inst->getType());
155+
if (expectedTy != caseTy)
156+
expectedTy = caseTy;
157+
recordClonedInstruction(Inst, getBuilder().createInitEnumDataAddr(
158+
getOpLocation(Inst->getLoc()), opd,
159+
Inst->getElement(), expectedTy));
148160
}
149161

150162
/// Projections should not change the type if the type is not specialized.

0 commit comments

Comments
 (0)