@@ -111,8 +111,7 @@ static bool replaceWithCallToVeclib(const TargetLibraryInfo &TLI,
111
111
SmallVector<Type *, 8 > ScalarArgTypes;
112
112
std::string ScalarName;
113
113
Function *FuncToReplace = nullptr ;
114
- auto *CI = dyn_cast<CallInst>(&I);
115
- if (CI) {
114
+ if (auto *CI = dyn_cast<CallInst>(&I)) {
116
115
FuncToReplace = CI->getCalledFunction ();
117
116
Intrinsic::ID IID = FuncToReplace->getIntrinsicID ();
118
117
assert (IID != Intrinsic::not_intrinsic && " Not an intrinsic" );
@@ -169,36 +168,12 @@ static bool replaceWithCallToVeclib(const TargetLibraryInfo &TLI,
169
168
if (!OptInfo)
170
169
return false ;
171
170
172
- // There is no guarantee that the vectorized instructions followed the VFABI
173
- // specification when being created, this is why we need to add extra check to
174
- // make sure that the operands of the vector function obtained via VFABI match
175
- // the operands of the original vector instruction.
176
- if (CI) {
177
- for (auto VFParam : OptInfo->Shape .Parameters ) {
178
- if (VFParam.ParamKind == VFParamKind::GlobalPredicate)
179
- continue ;
180
-
181
- // tryDemangleForVFABI must return valid ParamPos, otherwise it could be
182
- // a bug in the VFABI parser.
183
- assert (VFParam.ParamPos < CI->arg_size () &&
184
- " ParamPos has invalid range." );
185
- Type *OrigTy = CI->getArgOperand (VFParam.ParamPos )->getType ();
186
- if (OrigTy->isVectorTy () != (VFParam.ParamKind == VFParamKind::Vector)) {
187
- LLVM_DEBUG (dbgs () << DEBUG_TYPE << " : Will not replace: " << ScalarName
188
- << " . Wrong type at index " << VFParam.ParamPos
189
- << " : " << *OrigTy << " \n " );
190
- return false ;
191
- }
192
- }
193
- }
194
-
195
171
FunctionType *VectorFTy = VFABI::createFunctionType (*OptInfo, ScalarFTy);
196
172
if (!VectorFTy)
197
173
return false ;
198
174
199
175
Function *TLIFunc = getTLIFunction (I.getModule (), VectorFTy,
200
176
VD->getVectorFnName (), FuncToReplace);
201
-
202
177
replaceWithTLIFunction (I, *OptInfo, TLIFunc);
203
178
LLVM_DEBUG (dbgs () << DEBUG_TYPE << " : Replaced call to `" << ScalarName
204
179
<< " ` with call to `" << TLIFunc->getName () << " `.\n " );
@@ -245,9 +220,6 @@ PreservedAnalyses ReplaceWithVeclib::run(Function &F,
245
220
const TargetLibraryInfo &TLI = AM.getResult <TargetLibraryAnalysis>(F);
246
221
auto Changed = runImpl (TLI, F);
247
222
if (Changed) {
248
- LLVM_DEBUG (dbgs () << " Instructions replaced with vector libraries: "
249
- << NumCallsReplaced << " \n " );
250
-
251
223
PreservedAnalyses PA;
252
224
PA.preserveSet <CFGAnalyses>();
253
225
PA.preserve <TargetLibraryAnalysis>();
0 commit comments