[PATCH] D156575: [llvm[NFC] Adjust mem fn auto upgrade detection
Nathan Sidwell via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 2 13:49:40 PDT 2023
urnathan added inline comments.
================
Comment at: llvm/lib/IR/AutoUpgrade.cpp:1105
// the pointer args.
- if (Name.startswith("memcpy.") && F->arg_size() == 5) {
- rename(F);
- // Get the types of dest, src, and len
- ArrayRef<Type *> ParamTypes = F->getFunctionType()->params().slice(0, 3);
- NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::memcpy,
- ParamTypes);
- return true;
- }
- if (Name.startswith("memmove.") && F->arg_size() == 5) {
- rename(F);
- // Get the types of dest, src, and len
- ArrayRef<Type *> ParamTypes = F->getFunctionType()->params().slice(0, 3);
- NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::memmove,
- ParamTypes);
- return true;
+ if (unsigned ID = (Name.startswith("memcpy.") ? Intrinsic::memcpy
+ : Name.startswith("memmove.") ? Intrinsic::memmove
----------------
jroelofs wrote:
> `llvm::StringSwitch` might be a touch nicer for this
Sounds good
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156575/new/
https://reviews.llvm.org/D156575
More information about the llvm-commits
mailing list