[flang-commits] [flang] [flang] Added noalias attribute to function arguments. (PR #140803)
Tom Eccles via flang-commits
flang-commits at lists.llvm.org
Wed May 21 03:30:14 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:
What about TARGET dummy arguments e.g.
```
subroutine test(a)
real, target :: a
end subroutine
```
Here `a` is lowered to `!fir.ref<f32>`
https://github.com/llvm/llvm-project/pull/140803
More information about the flang-commits
mailing list