[flang-commits] [flang] [flang] Added noalias attribute to function arguments. (PR #140803)

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Thu May 22 02:36:08 PDT 2025


================
@@ -56,14 +47,28 @@ void FunctionAttrPass::runOnOperation() {
   if ((isFromModule || !func.isDeclaration()) &&
       !fir::hasBindcAttr(func.getOperation())) {
     llvm::StringRef nocapture = mlir::LLVM::LLVMDialect::getNoCaptureAttrName();
+    llvm::StringRef noalias = mlir::LLVM::LLVMDialect::getNoAliasAttrName();
     mlir::UnitAttr unitAttr = mlir::UnitAttr::get(func.getContext());
 
     for (auto [index, argType] : llvm::enumerate(func.getArgumentTypes())) {
+      bool isNoCapture = false;
+      bool isNoAlias = false;
       if (mlir::isa<fir::ReferenceType>(argType) &&
           !func.getArgAttr(index, fir::getTargetAttrName()) &&
           !func.getArgAttr(index, fir::getAsynchronousAttrName()) &&
-          !func.getArgAttr(index, fir::getVolatileAttrName()))
+          !func.getArgAttr(index, fir::getVolatileAttrName())) {
+        isNoCapture = true;
+        isNoAlias = !fir::isPointerType(argType);
----------------
tblah wrote:

Ahh sorry my mistake.

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


More information about the flang-commits mailing list