@@ -280,6 +280,7 @@ class ScalarizerVisitor : public InstVisitor<ScalarizerVisitor, bool> {
280280 bool visit (Function &F);
281281
282282 bool isTriviallyScalarizable (Intrinsic::ID ID);
283+ bool isIntrinsicWithOverloadTypeAtArg (Intrinsic::ID ID, int ScalarOpdIdx);
283284
284285 // InstVisitor methods. They return true if the instruction was scalarized,
285286 // false if nothing changed.
@@ -696,6 +697,13 @@ bool ScalarizerVisitor::isTriviallyScalarizable(Intrinsic::ID ID) {
696697 TTI->isTargetIntrinsicTriviallyScalarizable (ID);
697698}
698699
700+ bool ScalarizerVisitor::isIntrinsicWithOverloadTypeAtArg (Intrinsic::ID ID,
701+ int ScalarOpdIdx) {
702+ return Intrinsic::isTargetIntrinsic (ID)
703+ ? TTI->isVectorIntrinsicWithOverloadTypeAtArg (ID, ScalarOpdIdx)
704+ : isVectorIntrinsicWithOverloadTypeAtArg (ID, ScalarOpdIdx);
705+ }
706+
699707// / If a call to a vector typed intrinsic function, split into a scalar call per
700708// / element if possible for the intrinsic.
701709bool ScalarizerVisitor::splitCall (CallInst &CI) {
@@ -727,8 +735,7 @@ bool ScalarizerVisitor::splitCall(CallInst &CI) {
727735
728736 SmallVector<llvm::Type *, 3 > Tys;
729737 // Add return type if intrinsic is overloaded on it.
730- if (TTI->isVectorIntrinsicWithOverloadTypeAtArg (
731- ID, -1 , isVectorIntrinsicWithOverloadTypeAtArg (ID, -1 )))
738+ if (isIntrinsicWithOverloadTypeAtArg (ID, -1 ))
732739 Tys.push_back (VS->SplitTy );
733740
734741 if (AreAllVectorsOfMatchingSize) {
@@ -768,15 +775,13 @@ bool ScalarizerVisitor::splitCall(CallInst &CI) {
768775 }
769776
770777 Scattered[I] = scatter (&CI, OpI, *OpVS);
771- if (TTI->isVectorIntrinsicWithOverloadTypeAtArg (
772- ID, I, isVectorIntrinsicWithOverloadTypeAtArg (ID, I))) {
778+ if (isIntrinsicWithOverloadTypeAtArg (ID, I)) {
773779 OverloadIdx[I] = Tys.size ();
774780 Tys.push_back (OpVS->SplitTy );
775781 }
776782 } else {
777783 ScalarOperands[I] = OpI;
778- if (TTI->isVectorIntrinsicWithOverloadTypeAtArg (
779- ID, I, isVectorIntrinsicWithOverloadTypeAtArg (ID, I)))
784+ if (isIntrinsicWithOverloadTypeAtArg (ID, I))
780785 Tys.push_back (OpI->getType ());
781786 }
782787 }
0 commit comments