[clang] [CIR] Add restrict→noalias on non-builtin pointer params (PR #191483)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 13 06:41:47 PDT 2026


================
@@ -698,6 +698,23 @@ void CIRGenModule::constructFunctionArgumentAttributes(
             builder.getI64IntegerAttr(
                 getNaturalPointeeTypeAlignment(argType).getQuantity()));
     }
+
+    // restrict on pointer parameters -> noalias.  Skip builtins: OGCG only
+    // applies restrict->noalias through calling convention lowering, which
+    // builtins bypass.
+    if (fd) {
+      unsigned paramIdx = &argAttrList - argAttrs.data();
----------------
erichkeane wrote:

I could swear I've commented on this bit elsewhere, but getting to params like this is just inappropriate/sidesteps the organization of this function.  If we REALLY need parameter types instead of argument types, we should put them in the 'zip' above.

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


More information about the cfe-commits mailing list