diff options
author | Alex MacLean <amaclean@nvidia.com> | 2025-04-25 10:44:12 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-25 10:44:12 -0700 |
commit | a643ac439594a0a53799ee42932eef53618b091c (patch) | |
tree | a4243f163d0efec5bfe0e27b744f11b80ac7a9dc /llvm/lib/IR/AutoUpgrade.cpp | |
parent | 070a4ae2f9bcf6967a7147ed2972f409eaa7d3a6 (diff) | |
download | llvm-a643ac439594a0a53799ee42932eef53618b091c.zip llvm-a643ac439594a0a53799ee42932eef53618b091c.tar.gz llvm-a643ac439594a0a53799ee42932eef53618b091c.tar.bz2 |
[NVPTX] Remove 'param' variants of nvvm.ptr.* intrinics (#137065)
After #136008 these intrinsics are no longer inserted by the
compiler and can be upgraded to addrspacecasts.
Diffstat (limited to 'llvm/lib/IR/AutoUpgrade.cpp')
-rw-r--r-- | llvm/lib/IR/AutoUpgrade.cpp | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp index 01e9b61..2fd5b71 100644 --- a/llvm/lib/IR/AutoUpgrade.cpp +++ b/llvm/lib/IR/AutoUpgrade.cpp @@ -1054,6 +1054,12 @@ static Intrinsic::ID shouldUpgradeNVPTXBF16Intrinsic(StringRef Name) { return Intrinsic::not_intrinsic; } +static bool consumeNVVMPtrAddrSpace(StringRef &Name) { + return Name.consume_front("local") || Name.consume_front("shared") || + Name.consume_front("global") || Name.consume_front("constant") || + Name.consume_front("param"); +} + static bool upgradeIntrinsicFunction1(Function *F, Function *&NewFn, bool CanUpgradeDebugIntrinsicsToRecords) { assert(F && "Illegal to upgrade a non-existent Function."); @@ -1361,15 +1367,11 @@ static bool upgradeIntrinsicFunction1(Function *F, Function *&NewFn, // nvvm.rotate.{b32,b64,right.b64} Expand = Name == "b32" || Name == "b64" || Name == "right.b64"; else if (Name.consume_front("ptr.gen.to.")) - // nvvm.ptr.gen.to.{local,shared,global,constant} - Expand = Name.starts_with("local") || Name.starts_with("shared") || - Name.starts_with("global") || Name.starts_with("constant"); + // nvvm.ptr.gen.to.{local,shared,global,constant,param} + Expand = consumeNVVMPtrAddrSpace(Name); else if (Name.consume_front("ptr.")) - // nvvm.ptr.{local,shared,global,constant}.to.gen - Expand = - (Name.consume_front("local") || Name.consume_front("shared") || - Name.consume_front("global") || Name.consume_front("constant")) && - Name.starts_with(".to.gen"); + // nvvm.ptr.{local,shared,global,constant,param}.to.gen + Expand = consumeNVVMPtrAddrSpace(Name) && Name.starts_with(".to.gen"); else if (Name.consume_front("ldg.global.")) // nvvm.ldg.global.{i,p,f} Expand = (Name.starts_with("i.") || Name.starts_with("f.") || @@ -2450,12 +2452,8 @@ static Value *upgradeNVVMIntrinsicCall(StringRef Name, CallBase *CI, Rep = Builder.CreateIntrinsic(Int64Ty, Intrinsic::fshl, {Arg, Arg, Builder.getInt64(32)}); } else if ((Name.consume_front("ptr.gen.to.") && - (Name.starts_with("local") || Name.starts_with("shared") || - Name.starts_with("global") || Name.starts_with("constant"))) || - (Name.consume_front("ptr.") && - (Name.consume_front("local") || Name.consume_front("shared") || - Name.consume_front("global") || - Name.consume_front("constant")) && + consumeNVVMPtrAddrSpace(Name)) || + (Name.consume_front("ptr.") && consumeNVVMPtrAddrSpace(Name) && Name.starts_with(".to.gen"))) { Rep = Builder.CreateAddrSpaceCast(CI->getArgOperand(0), CI->getType()); } else if (Name.consume_front("ldg.global")) { |