@@ -74,9 +74,10 @@ void VPlanTransforms::VPInstructionsToVPRecipes(
7474 } else if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(Inst)) {
7575 NewRecipe = new VPWidenGEPRecipe (GEP, Ingredient.operands ());
7676 } else if (CallInst *CI = dyn_cast<CallInst>(Inst)) {
77- NewRecipe = new VPWidenCallRecipe (
78- *CI, drop_end (Ingredient.operands ()),
79- getVectorIntrinsicIDForCall (CI, &TLI), CI->getDebugLoc ());
77+ NewRecipe =
78+ new VPWidenCallRecipe (*CI, drop_end (Ingredient.operands ()),
79+ getVectorIntrinsicIDForCall (CI, &TLI),
80+ CI->getType (), CI->getDebugLoc ());
8081 } else if (SelectInst *SI = dyn_cast<SelectInst>(Inst)) {
8182 NewRecipe = new VPWidenSelectRecipe (*SI, Ingredient.operands ());
8283 } else if (auto *CI = dyn_cast<CastInst>(Inst)) {
@@ -975,8 +976,8 @@ void VPlanTransforms::truncateToMinimalBitwidths(
975976 for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(
976977 vp_depth_first_deep (Plan.getVectorLoopRegion ()))) {
977978 for (VPRecipeBase &R : make_early_inc_range (*VPBB)) {
978- if (!isa<VPWidenRecipe, VPWidenCastRecipe, VPReplicateRecipe ,
979- VPWidenSelectRecipe, VPWidenLoadRecipe>(&R))
979+ if (!isa<VPWidenRecipe, VPWidenCallRecipe, VPWidenCastRecipe ,
980+ VPReplicateRecipe, VPWidenSelectRecipe, VPWidenLoadRecipe>(&R))
980981 continue ;
981982
982983 VPValue *ResultVPV = R.getVPSingleValue ();
@@ -1082,6 +1083,12 @@ void VPlanTransforms::truncateToMinimalBitwidths(
10821083 }
10831084 }
10841085
1086+ // If this was a WIDEN-CALL (intrinsic) then we need to update the return
1087+ // type so it's compatible with the new args.
1088+ if (isa<VPWidenCallRecipe>(&R)) {
1089+ auto *callInsn = dyn_cast<VPWidenCallRecipe>(&R);
1090+ callInsn->setResultType (NewResTy);
1091+ }
10851092 }
10861093 }
10871094
0 commit comments