File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -142,6 +142,8 @@ static bool canHandleAllocStack(AllocStackInst *asi) {
142
142
if (asi->hasDynamicLifetime ())
143
143
return false ;
144
144
145
+ SILType stackType = asi->getType ();
146
+
145
147
// Currently in this verifier, we stop verifying if we find a switch_enum_addr
146
148
// use. This creates a problem since no one has gone through and changed the
147
149
// frontend/optimizer to understand that it needs to insert destroy_addr on
@@ -155,9 +157,16 @@ static bool canHandleAllocStack(AllocStackInst *asi) {
155
157
// implemented.
156
158
//
157
159
// https://bugs.swift.org/browse/SR-14123
158
- if (asi-> getType () .getEnumOrBoundGenericEnum ())
160
+ if (stackType .getEnumOrBoundGenericEnum ())
159
161
return false ;
160
162
163
+ // Same for tuples that have an enum element. We are just working around this
164
+ // for now until the radar above is solved.
165
+ if (auto tt = stackType.getAs <TupleType>())
166
+ for (unsigned i : range (tt->getNumElements ()))
167
+ if (stackType.getTupleElementType (i).getEnumOrBoundGenericEnum ())
168
+ return false ;
169
+
161
170
// Otherwise we can optimize!
162
171
return true ;
163
172
}
You can’t perform that action at this time.
0 commit comments