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

Dharuni R Acharya via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 20 23:00:08 PDT 2026


================
@@ -5394,33 +5397,32 @@ static bool upgradeIntrinsicCallWithDefaultArgs(CallBase *CI, Function *NewFn,
   unsigned OldArgCount = CI->arg_size();
   unsigned NewArgCount = NewFn->arg_size();
 
-  // If the caller already supplied all arguments (or more), nothing to do.
-  // This mirrors C++ semantics: an explicitly-passed value is never overridden.
-  if (OldArgCount >= NewArgCount)
+  if (OldArgCount > NewArgCount)
     return false;
 
-  // Start with the existing arguments from the old call.
-  SmallVector<Value *, 8> NewArgs(CI->args());
+  if (OldArgCount == NewArgCount) {
+    if (CI->getFunctionType() != NewFn->getFunctionType())
+      return false;
+    CI->setCalledFunction(NewFn);
+    return true;
+  }
 
-  // Defaults are a contiguous trailing block, so checking the first missing
-  // argument is enough.
   if (OldArgCount < FirstDefault)
     return false;
----------------
DharuniRAcharya wrote:

Updated in the latest revision!

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


More information about the llvm-commits mailing list