[clang] [CIR] Add restrict→noalias on non-builtin pointer params (PR #191483)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 14 11:51:53 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();
----------------
adams381 wrote:
Done. Built a parallel SmallVector<const ParmVarDecl *> aligned with argAttrs (nullptr for `this` and any extra slots), then added it to the zip_equal loop. No more manual index arithmetic — the ParmVarDecl is accessed directly as `pvd` in the structured binding. Also fixed stale noalias-on-call-site CHECK lines in asm-label-inline-builtins.c.
https://github.com/llvm/llvm-project/pull/191483
More information about the cfe-commits
mailing list