Skip to content

Commit e309667

Browse files
committed
[AutoUpgrade] Simplify vclz upgrade (NFC)
We can use Intrinsic::getDeclaration() here, we just have to pass the correct arguments. This function accepts only the mangled types, not all argument types.
1 parent 374e828 commit e309667

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

llvm/lib/IR/AutoUpgrade.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -782,16 +782,8 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
782782
return true;
783783
}
784784
if (Name.starts_with("arm.neon.vclz")) {
785-
Type* args[2] = {
786-
F->arg_begin()->getType(),
787-
Type::getInt1Ty(F->getContext())
788-
};
789-
// Can't use Intrinsic::getDeclaration here as it adds a ".i1" to
790-
// the end of the name. Change name from llvm.arm.neon.vclz.* to
791-
// llvm.ctlz.*
792-
FunctionType* fType = FunctionType::get(F->getReturnType(), args, false);
793-
NewFn = Function::Create(fType, F->getLinkage(), F->getAddressSpace(),
794-
"llvm.ctlz." + Name.substr(14), F->getParent());
785+
NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::ctlz,
786+
F->arg_begin()->getType());
795787
return true;
796788
}
797789
if (Name.starts_with("arm.neon.vcnt")) {

0 commit comments

Comments
 (0)