[llvm] [LLVM][Auto-Upgrade] Support default args on overloaded intrinsics and undeclared multi-call upgrades (PR #216246)

Durgadoss R via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 14 05:20:28 PDT 2026


================
@@ -1383,33 +1383,75 @@ static bool convertIntrinsicValidType(StringRef Name,
   return false;
 }
 
-static bool upgradeIntrinsicDeclWithDefaultArgs(Function *F, Function *&NewFn) {
-  Intrinsic::ID IID = Intrinsic::lookupIntrinsicID(F->getName());
-  if (IID == Intrinsic::not_intrinsic)
-    return false;
-
+static bool getDefaultArgUpgradeInfo(Function *F, Intrinsic::ID IID,
+                                     SmallVectorImpl<Type *> &OverloadTys) {
   auto [FirstDefault, Defaults] = Intrinsic::getAllDefaultArgValues(IID);
   if (Defaults.empty())
     return false;
 
-  // Overloaded intrinsics are out of scope for the default-arg feature
-  // and will be supported in a follow-up.
-  if (Intrinsic::isOverloaded(IID))
-    return false;
-
-  // Get the canonical full declaration for this intrinsic.
-  Function *FullDecl = Intrinsic::getOrInsertDeclaration(F->getParent(), IID);
----------------
durga4github wrote:

Looking at our existing upgrade schemes, I wonder if this can be addressed by a `rename(F)` before we call
`getOrInsertDeclaration`... Could you please check?

https://github.com/llvm/llvm-project/pull/216246


More information about the llvm-commits mailing list