[PATCH] D156575: [llvm[NFC] Adjust mem fn auto upgrade detection
Jon Roelofs via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 28 15:20:42 PDT 2023
jroelofs accepted this revision.
jroelofs added a comment.
This revision is now accepted and ready to land.
LGTM
================
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
----------------
`llvm::StringSwitch` might be a touch nicer for this
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156575/new/
https://reviews.llvm.org/D156575
More information about the llvm-commits
mailing list