[clang] [llvm] [mlir] [IR] Replace alignment argument with attribute on masked intrinsics (PR #163802)

Yingwei Zheng via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 17 10:00:00 PDT 2025


================
@@ -725,6 +725,19 @@ Function *Intrinsic::getOrInsertDeclaration(Module *M, ID id,
   // There can never be multiple globals with the same name of different types,
   // because intrinsics must be a specific type.
   auto *FT = getType(M->getContext(), id, Tys);
+  Function *F = cast<Function>(
+      M->getOrInsertFunction(
+           Tys.empty() ? getName(id) : getName(id, Tys, M, FT), FT)
+          .getCallee());
+  if (F->getFunctionType() == FT)
+    return F;
+
+  // It's possible that a declaration for this intrinsic already exists with an
+  // incorrect signature, if the signature has changed, but this particular
+  // declaration has not been auto-upgraded yet. In that case, rename the
+  // invalid declaration and insert a new one with the correct signature. The
+  // invalid declaration will get upgraded later.
+  F->setName(F->getName() + ".invalid");
----------------
dtcxzyw wrote:

Which test corresponds to this change? We have renamed the old intrinsic to `name+old` in `upgradeIntrinsicFunction1`. Isn't it enough? Why didn't we need this in the last migration of memcpy/memset/memmove?



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


More information about the cfe-commits mailing list