[PATCH] D157763: [llvm][NFC] Adjust AutoUpdater 'masked' address-space access
Nathan Sidwell via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 12 14:28:35 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG037f203601c9: [llvm][NFC] Adjust address-space access auto upgrade detection (authored by urnathan).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157763/new/
https://reviews.llvm.org/D157763
Files:
llvm/lib/IR/AutoUpgrade.cpp
Index: llvm/lib/IR/AutoUpgrade.cpp
===================================================================
--- llvm/lib/IR/AutoUpgrade.cpp
+++ llvm/lib/IR/AutoUpgrade.cpp
@@ -1053,51 +1053,34 @@
break;
}
case 'm': {
- if (Name.startswith("masked.load.")) {
- Type *Tys[] = { F->getReturnType(), F->arg_begin()->getType() };
- if (F->getName() !=
- Intrinsic::getName(Intrinsic::masked_load, Tys, F->getParent())) {
- rename(F);
- NewFn = Intrinsic::getDeclaration(F->getParent(),
- Intrinsic::masked_load,
- Tys);
- return true;
- }
- }
- if (Name.startswith("masked.store.")) {
- auto Args = F->getFunctionType()->params();
- Type *Tys[] = { Args[0], Args[1] };
- if (F->getName() !=
- Intrinsic::getName(Intrinsic::masked_store, Tys, F->getParent())) {
- rename(F);
- NewFn = Intrinsic::getDeclaration(F->getParent(),
- Intrinsic::masked_store,
- Tys);
- return true;
- }
- }
- // Renaming gather/scatter intrinsics with no address space overloading
- // to the new overload which includes an address space
- if (Name.startswith("masked.gather.")) {
- Type *Tys[] = {F->getReturnType(), F->arg_begin()->getType()};
- if (F->getName() !=
- Intrinsic::getName(Intrinsic::masked_gather, Tys, F->getParent())) {
- rename(F);
- NewFn = Intrinsic::getDeclaration(F->getParent(),
- Intrinsic::masked_gather, Tys);
- return true;
- }
- }
- if (Name.startswith("masked.scatter.")) {
- auto Args = F->getFunctionType()->params();
- Type *Tys[] = {Args[0], Args[1]};
- if (F->getName() !=
- Intrinsic::getName(Intrinsic::masked_scatter, Tys, F->getParent())) {
- rename(F);
- NewFn = Intrinsic::getDeclaration(F->getParent(),
- Intrinsic::masked_scatter, Tys);
- return true;
+ StringRef MaskPfx = "masked.";
+ if (Name.startswith(MaskPfx)) {
+ // Renaming masked intrinsics with no address space overloading
+ // to the new overload, which includes an address space.
+ Intrinsic::ID ID =
+ StringSwitch<Intrinsic::ID>(Name.substr(MaskPfx.size()))
+ .StartsWith("load.", Intrinsic::masked_load)
+ .StartsWith("store.", Intrinsic::masked_store)
+ .StartsWith("gather.", Intrinsic::masked_gather)
+ .StartsWith("scatter.", Intrinsic::masked_scatter)
+ .Default(Intrinsic::not_intrinsic);
+ if (ID != Intrinsic::not_intrinsic) {
+ const auto *FT = F->getFunctionType();
+ SmallVector<Type *, 2> Tys;
+ if (ID == Intrinsic::masked_load || ID == Intrinsic::masked_gather)
+ // Loading operations overload on the return type.
+ Tys.push_back(FT->getReturnType());
+ Tys.push_back(FT->getParamType(0));
+ if (ID == Intrinsic::masked_store || ID == Intrinsic::masked_scatter)
+ // Store operations overload on the stored type.
+ Tys.push_back(FT->getParamType(1));
+ if (F->getName() != Intrinsic::getName(ID, Tys, F->getParent())) {
+ rename(F);
+ NewFn = Intrinsic::getDeclaration(F->getParent(), ID, Tys);
+ return true;
+ }
}
+ break; // No other 'masked.*'
}
// Updating the memory intrinsics (memcpy/memmove/memset) that have an
// alignment parameter to embedding the alignment as an attribute of
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157763.549647.patch
Type: text/x-patch
Size: 3691 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230812/681cd33a/attachment.bin>
More information about the llvm-commits
mailing list