@@ -932,7 +932,7 @@ SILInstruction *SILCombiner::optimizeBuiltinCompareEq(BuiltinInst *BI,
932
932
}
933
933
934
934
SILInstruction *
935
- SILCombiner::optimizeApplyOfConvertFunctionInst (FullApplySite AI,
935
+ SILCombiner::optimizeApplyOfConvertFunctionInst (ApplyInst * AI,
936
936
ConvertFunctionInst *CFI) {
937
937
// We only handle simplification of static function references. If we don't
938
938
// have one, bail.
@@ -941,7 +941,7 @@ SILCombiner::optimizeApplyOfConvertFunctionInst(FullApplySite AI,
941
941
return nullptr ;
942
942
943
943
// Grab our relevant callee types...
944
- CanSILFunctionType SubstCalleeTy = AI. getSubstCalleeType ();
944
+ CanSILFunctionType SubstCalleeTy = AI-> getSubstCalleeType ();
945
945
auto ConvertCalleeTy =
946
946
CFI->getOperand ().getType ().castTo <SILFunctionType>();
947
947
@@ -951,7 +951,7 @@ SILCombiner::optimizeApplyOfConvertFunctionInst(FullApplySite AI,
951
951
952
952
// Ok, we can now perform our transformation. Grab AI's operands and the
953
953
// relevant types from the ConvertFunction function type and AI.
954
- OperandValueArrayRef Ops = AI. getArgumentsWithoutIndirectResult ();
954
+ OperandValueArrayRef Ops = AI-> getArgumentsWithoutIndirectResult ();
955
955
auto OldOpTypes = SubstCalleeTy->getParameterSILTypes ();
956
956
auto NewOpTypes = ConvertCalleeTy->getParameterSILTypes ();
957
957
@@ -970,14 +970,14 @@ SILCombiner::optimizeApplyOfConvertFunctionInst(FullApplySite AI,
970
970
// other types alone.
971
971
if (OldOpType.isAddress ()) {
972
972
assert (NewOpType.isAddress () && " Addresses should map to addresses." );
973
- auto UAC = Builder->createUncheckedAddrCast (AI. getLoc (), Op, NewOpType);
974
- UAC->setDebugScope (AI. getDebugScope ());
973
+ auto UAC = Builder->createUncheckedAddrCast (AI-> getLoc (), Op, NewOpType);
974
+ UAC->setDebugScope (AI-> getDebugScope ());
975
975
Args.push_back (UAC);
976
976
} else if (OldOpType.isHeapObjectReferenceType ()) {
977
977
assert (NewOpType.isHeapObjectReferenceType () &&
978
978
" refs should map to refs." );
979
- auto URC = Builder->createUncheckedRefCast (AI. getLoc (), Op, NewOpType);
980
- URC->setDebugScope (AI. getDebugScope ());
979
+ auto URC = Builder->createUncheckedRefCast (AI-> getLoc (), Op, NewOpType);
980
+ URC->setDebugScope (AI-> getDebugScope ());
981
981
Args.push_back (URC);
982
982
} else {
983
983
Args.push_back (Op);
@@ -986,18 +986,11 @@ SILCombiner::optimizeApplyOfConvertFunctionInst(FullApplySite AI,
986
986
987
987
SILType CCSILTy = SILType::getPrimitiveObjectType (ConvertCalleeTy);
988
988
// Create the new apply inst.
989
- SILInstruction *NAI;
990
- if (auto *TAI = dyn_cast<TryApplyInst>(AI))
991
- NAI = TryApplyInst::create (AI.getLoc (), FRI, CCSILTy,
989
+ auto NAI = ApplyInst::create (AI->getLoc (), FRI, CCSILTy,
990
+ ConvertCalleeTy->getSILResult (),
992
991
ArrayRef<Substitution>(), Args,
993
- TAI->getNormalBB (), TAI->getErrorBB (),
994
992
*FRI->getReferencedFunction ());
995
- else
996
- NAI = ApplyInst::create (AI.getLoc (), FRI, CCSILTy,
997
- ConvertCalleeTy->getSILResult (),
998
- ArrayRef<Substitution>(), Args,
999
- *FRI->getReferencedFunction ());
1000
- NAI->setDebugScope (AI.getDebugScope ());
993
+ NAI->setDebugScope (AI->getDebugScope ());
1001
994
return NAI;
1002
995
}
1003
996
0 commit comments