8 Commits

Author SHA1 Message Date
Slava Zakharin
a0d699a8e6 Reland "[flang] Added noalias attribute to function arguments. (#140803)"
This helps to disambiguate accesses in the caller and the callee
after LLVM inlining in some apps. I did not see any performance
changes, but this is one step towards enabling other optimizations
in the apps that I am looking at.

The definition of llvm.noalias says:
```
... indicates that memory locations accessed via pointer values based on the argument or return value are not also accessed, during the execution of the function, via pointer values not based on the argument or return value. This guarantee only holds for memory locations that are modified, by any means, during the execution of the function.
```

I believe this exactly matches Fortran rules for the dummy arguments
that are modified during their subprogram execution.

I also set llvm.noalias and llvm.nocapture on the !fir.box<> arguments,
because the corresponding descriptors cannot be captured and cannot
alias anything (not based on them) during the execution of the
subprogram.
2025-05-29 13:42:57 -07:00
Slava Zakharin
6ee2453360
Revert "[flang] Added noalias attribute to function arguments." (#141884)
Reverts llvm/llvm-project#140803

Buildbot failure:
https://lab.llvm.org/buildbot/#/builders/143/builds/8041
2025-05-28 18:06:11 -07:00
Slava Zakharin
2426ac6865
[flang] Added noalias attribute to function arguments. (#140803)
This helps to disambiguate accesses in the caller and the callee
after LLVM inlining in some apps. I did not see any performance
changes, but this is one step towards enabling other optimizations
in the apps that I am looking at.

The definition of llvm.noalias says:
```
... indicates that memory locations accessed via pointer values based on the argument or return value are not also accessed, during the execution of the function, via pointer values not based on the argument or return value. This guarantee only holds for memory locations that are modified, by any means, during the execution of the function.
```

I believe this exactly matches Fortran rules for the dummy arguments
that are modified during their subprogram execution.

I also set llvm.noalias and llvm.nocapture on the !fir.box<> arguments,
because the corresponding descriptors cannot be captured and cannot
alias anything (not based on them) during the execution of the
subprogram.
2025-05-28 17:18:04 -07:00
Anchu Rajendran S
580da48a93
[flang][flang-driver] Support flag -finstrument-functions (#137996) 2025-05-02 07:38:44 -07:00
s-watanabe314
f3cf24fcc4
[flang] Apply nocapture attribute to dummy arguments (#116182)
Apply llvm.nocapture attribute to dummy arguments that do not have the
target, asynchronous, volatile, or pointer attributes in a procedure
that is not a bind(c). This was discussed in


https://discourse.llvm.org/t/applying-the-nocapture-attribute-to-reference-passed-arguments-in-fortran-subroutines/81401
2024-11-28 15:39:26 +09:00
Tom Eccles
a6129a56d3
[flang][Transforms][NFC] reduce boilerplate in func attr pass (#94739)
Use tablegen to automatically create the pass constructor.

The purpose of this pass is to add attributes to functions, so it
doesn't need to work on other top level operations.
2024-06-10 10:43:56 +01:00
Alex Bradbury
22544e2a54
[flang] Set fast math related function attributes for -Ofast/-ffast-math (#79301)
The implemented logic matches the logic used for Clang in emitting these
attributes. Although it's hoped that function attributes won't be needed
in the future (vs using fast math flags in individual IR instructions),
there are codegen differences currently with/without these attributes,
as can be seen in issues like #79257 or by hacking Clang to avoid
producing these attributes and observing codegen changes.
2024-02-05 19:39:12 +00:00
Radu Salavat
0487377382
[flang] Pass to add frame pointer attribute (#74598)
Pass to add frame pointer attribute in Flang
2023-12-28 15:41:27 +00:00