@@ -694,9 +694,9 @@ SILCombiner::propagateSoleConformingType(FullApplySite Apply,
694694 replaceWitnessMethodInst (WMI, BuilderCtx, ConcreteType,
695695 *(CEI.ExistentialSubs .getConformances ().begin ()));
696696 // Construct the map for Self to be used for createApplyWithConcreteType.
697- llvm::SmallDenseMap<unsigned , const ConcreteExistentialInfo * > CEIs;
698- CEIs.insert (std::pair<unsigned , const ConcreteExistentialInfo * >(
699- Apply.getCalleeArgIndex (Apply.getSelfArgumentOperand ()), & CEI));
697+ llvm::SmallDenseMap<unsigned , ConcreteExistentialInfo> CEIs;
698+ CEIs.insert (std::pair<unsigned , ConcreteExistentialInfo>(
699+ Apply.getCalleeArgIndex (Apply.getSelfArgumentOperand ()), CEI));
700700 // / Create the new apply instruction using the concrete type.
701701 auto *NewAI = createApplyWithConcreteType (Apply, CEIs, BuilderCtx);
702702 return NewAI;
@@ -795,8 +795,9 @@ bool SILCombiner::canReplaceArg(FullApplySite Apply,
795795 }
796796 // The apply can only be rewritten in terms of the concrete value if it is
797797 // legal to pass that value as the Arg argument.
798- if (CEI.isCopied && (!CEI.InitExistential ||
799- !canReplaceCopiedArg (Apply, CEI.InitExistential , DA, ArgIdx))) {
798+ if (CEI.isCopied &&
799+ (!CEI.InitExistential ||
800+ !canReplaceCopiedArg (Apply, CEI.InitExistential , DA, ArgIdx))) {
800801 return false ;
801802 }
802803 // It is safe to replace Arg.
@@ -828,7 +829,7 @@ bool SILCombiner::canReplaceArg(FullApplySite Apply,
828829// / SSA uses in those cases. Currently we bail out on methods that return Self.
829830SILInstruction *SILCombiner::createApplyWithConcreteType (
830831 FullApplySite Apply,
831- const llvm::SmallDenseMap<unsigned , const ConcreteExistentialInfo * > &CEIs,
832+ const llvm::SmallDenseMap<unsigned , ConcreteExistentialInfo> &CEIs,
832833 SILBuilderContext &BuilderCtx) {
833834
834835 // Ensure that the callee is polymorphic.
@@ -846,32 +847,32 @@ SILInstruction *SILCombiner::createApplyWithConcreteType(
846847 NewArgs.push_back (Apply.getArgument (ArgIdx));
847848 continue ;
848849 }
849- auto * CEI = ArgIt->second ;
850+ auto & CEI = ArgIt->second ;
850851 // Check for Arg's concrete type propagation legality.
851- if (!canReplaceArg (Apply, * CEI, ArgIdx)) {
852+ if (!canReplaceArg (Apply, CEI, ArgIdx)) {
852853 NewArgs.push_back (Apply.getArgument (ArgIdx));
853854 continue ;
854855 }
855856 UpdatedArgs = true ;
856857 // Ensure that we have a concrete value to propagate.
857- assert (CEI-> ConcreteValue );
858- NewArgs.push_back (CEI-> ConcreteValue );
858+ assert (CEI. ConcreteValue );
859+ NewArgs.push_back (CEI. ConcreteValue );
859860 // Form a new set of substitutions where the argument is
860861 // replaced with a concrete type.
861862 NewCallSubs = NewCallSubs.subst (
862863 [&](SubstitutableType *type) -> Type {
863- if (type == CEI-> OpenedArchetype )
864- return CEI-> ConcreteType ;
864+ if (type == CEI. OpenedArchetype )
865+ return CEI. ConcreteType ;
865866 return type;
866867 },
867868 [&](CanType origTy, Type substTy,
868869 ProtocolDecl *proto) -> Optional<ProtocolConformanceRef> {
869- if (origTy->isEqual (CEI-> OpenedArchetype )) {
870- assert (substTy->isEqual (CEI-> ConcreteType ));
870+ if (origTy->isEqual (CEI. OpenedArchetype )) {
871+ assert (substTy->isEqual (CEI. ConcreteType ));
871872 // Do a conformance lookup on this witness requirement using the
872873 // existential's conformances. The witness requirement may be a
873874 // base type of the existential's requirements.
874- return CEI-> lookupExistentialConformance (proto);
875+ return CEI. lookupExistentialConformance (proto);
875876 }
876877 return ProtocolConformanceRef (proto);
877878 });
@@ -960,9 +961,9 @@ SILCombiner::propagateConcreteTypeOfInitExistential(FullApplySite Apply,
960961 SelfConformance);
961962 }
962963 // Construct the map for Self to be used for createApplyWithConcreteType.
963- llvm::SmallDenseMap<unsigned , const ConcreteExistentialInfo * > CEIs;
964- CEIs.insert (std::pair<unsigned , const ConcreteExistentialInfo * >(
965- Apply.getCalleeArgIndex (Apply.getSelfArgumentOperand ()), & CEI));
964+ llvm::SmallDenseMap<unsigned , ConcreteExistentialInfo> CEIs;
965+ CEIs.insert (std::pair<unsigned , ConcreteExistentialInfo>(
966+ Apply.getCalleeArgIndex (Apply.getSelfArgumentOperand ()), CEI));
966967 // Try to rewrite the apply.
967968 return createApplyWithConcreteType (Apply, CEIs, BuilderCtx);
968969}
@@ -986,7 +987,7 @@ SILCombiner::propagateConcreteTypeOfInitExistential(FullApplySite Apply) {
986987 SILBuilderContext BuilderCtx (Builder.getModule (), Builder.getTrackingList ());
987988 SILOpenedArchetypesTracker OpenedArchetypesTracker (&Builder.getFunction ());
988989 BuilderCtx.setOpenedArchetypesTracker (&OpenedArchetypesTracker);
989- llvm::SmallDenseMap<unsigned , const ConcreteExistentialInfo * > CEIs;
990+ llvm::SmallDenseMap<unsigned , ConcreteExistentialInfo> CEIs;
990991 for (unsigned ArgIdx = 0 ; ArgIdx < Apply.getNumArguments (); ArgIdx++) {
991992 auto ArgASTType = Apply.getArgument (ArgIdx)->getType ().getASTType ();
992993 if (!ArgASTType->hasArchetype ())
@@ -995,8 +996,7 @@ SILCombiner::propagateConcreteTypeOfInitExistential(FullApplySite Apply) {
995996 if (!CEI.isValid ())
996997 continue ;
997998
998- CEIs.insert (
999- std::pair<unsigned , const ConcreteExistentialInfo *>(ArgIdx, &CEI));
999+ CEIs.insert (std::pair<unsigned , ConcreteExistentialInfo>(ArgIdx, CEI));
10001000
10011001 if (CEI.ConcreteType ->isOpenedExistential ()) {
10021002 // Temporarily record this opened existential def in this local
0 commit comments