================
@@ -708,6 +713,33 @@ void CIRGenModule::constructFunctionArgumentAttributes(
             builder.getI64IntegerAttr(
                 getNaturalPointeeTypeAlignment(argType).getQuantity()));
     }
+
+    // Source-level parameter attributes (restrict, nonnull).  These
+    // require the FunctionDecl to access ParmVarDecl info.
+    if (fd) {
+      unsigned paramIdx = &argAttrList - argAttrs.data();
+      unsigned srcIdx = info.isInstanceMethod() ? paramIdx - 1 : paramIdx;
+      if (srcIdx < fd->getNumParams()) {
+        const ParmVarDecl *pvd = fd->getParamDecl(srcIdx);
+        QualType pvdType = pvd->getType();
+
+        // restrict on pointer parameters → noalias.
+        if (pvdType->isPointerType() && pvdType.isRestrictQualified())
----------------
andykaylor wrote:

It's not clear to me whether this is a bug in classic codegen or not. What 
you're doing here looks correct. Classic codegen is checking 
`Arg->getType().isRestrictQualified()`. Maybe this is missing the restrict 
qualifier?

https://github.com/llvm/llvm-project/pull/188281
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to