@@ -818,28 +818,33 @@ PromotedParamCloner::visitStrongRetainInst(StrongRetainInst *Inst) {
818
818
SILCloner<PromotedParamCloner>::visitStrongRetainInst (Inst);
819
819
}
820
820
821
- void PromotedParamCloner::visitCopyValueInst (CopyValueInst *CVI ) {
821
+ void PromotedParamCloner::visitCopyValueInst (CopyValueInst *cvi ) {
822
822
// If it's a copy of a promoted parameter, just drop the instruction.
823
- auto *Tmp = CVI ;
824
- while (auto *CopyOp = dyn_cast<CopyValueInst>(Tmp ->getOperand ())) {
825
- Tmp = CopyOp ;
823
+ auto *tmp = cvi ;
824
+ while (auto *copyOp = dyn_cast<CopyValueInst>(tmp ->getOperand ())) {
825
+ tmp = copyOp ;
826
826
}
827
- if (OrigPromotedParameters.count (Tmp ->getOperand ()))
827
+ if (OrigPromotedParameters.count (tmp ->getOperand ()))
828
828
return ;
829
829
830
- SILCloner<PromotedParamCloner>::visitCopyValueInst (CVI );
830
+ SILCloner<PromotedParamCloner>::visitCopyValueInst (cvi );
831
831
}
832
832
833
- void PromotedParamCloner::visitProjectBoxInst (ProjectBoxInst *Inst) {
834
- // If it's a projection of a promoted parameter, drop the instruction.
835
- // Its uses will be replaced by the promoted address.
836
- if (OrigPromotedParameters.count (Inst->getOperand ())) {
837
- auto *origArg = cast<SILFunctionArgument>(Inst->getOperand ());
838
- recordFoldedValue (Inst, NewPromotedArgs[origArg->getIndex ()]);
833
+ void PromotedParamCloner::visitProjectBoxInst (ProjectBoxInst *pbi) {
834
+ // If it's a projection of a promoted parameter (or a copy_value of a promoted
835
+ // parameter), drop the instruction. Its uses will be replaced by the
836
+ // promoted address.
837
+ SILValue box = pbi->getOperand ();
838
+ while (auto *copyOp = dyn_cast<CopyValueInst>(box)) {
839
+ box = copyOp->getOperand ();
840
+ }
841
+ if (OrigPromotedParameters.count (box)) {
842
+ auto *origArg = cast<SILFunctionArgument>(box);
843
+ recordFoldedValue (pbi, NewPromotedArgs[origArg->getIndex ()]);
839
844
return ;
840
845
}
841
846
842
- SILCloner<PromotedParamCloner>::visitProjectBoxInst (Inst );
847
+ SILCloner<PromotedParamCloner>::visitProjectBoxInst (pbi );
843
848
}
844
849
845
850
// While cloning during specialization, make sure apply instructions do not have
0 commit comments