File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed
lib/SILOptimizer/Transforms Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -238,10 +238,21 @@ bool ProtocolDevirtualizer::canDevirtualizeProtocolInFunction(ProtocolDevirtuali
238
238
auto ProtoDecl = dyn_cast<ProtocolDecl>(SwiftProtoDecl);
239
239
auto CD = PDA->getSoleClassImplementingProtocol (ProtoDecl);
240
240
if (CD) {
241
- // / Save the mapping for transformation pass.
242
- Arg2DeclMap[i] = std::make_pair (ProtoDecl, CD);
243
- DEBUG (llvm::dbgs () << " Function: " << F->getName () << " has a singel class decl\n " );
244
- returnFlag |= true ;
241
+ bool UnknownPattern = false ;
242
+ for (auto *Op : Args[i]->getUses ()) {
243
+ auto User = Op->getUser ();
244
+ auto *Open = dyn_cast<OpenExistentialRefInst>(User);
245
+ auto *Debug = dyn_cast<DebugValueInst>(User);
246
+ if (!(Open || Debug)) {
247
+ UnknownPattern = true ;
248
+ }
249
+ }
250
+ if (!UnknownPattern) {
251
+ // / Save the mapping for transformation pass.
252
+ Arg2DeclMap[i] = std::make_pair (ProtoDecl, CD);
253
+ DEBUG (llvm::dbgs () << " Function: " << F->getName () << " has a singel class decl\n " );
254
+ returnFlag |= true ;
255
+ }
245
256
}
246
257
}
247
258
}
You can’t perform that action at this time.
0 commit comments