[flang-commits] [flang] [flang] Apply nocapture attribute to dummy arguments (PR #116182)
via flang-commits
flang-commits at lists.llvm.org
Mon Nov 18 23:54:40 PST 2024
s-watanabe314 wrote:
> The change in the pass looks good to me, but you should probably enable this pass by default (or at least when O > O0, opinions welcomed here) because it is currently only run under a specific set of conditions (see
>
> https://github.com/llvm/llvm-project/blob/40afff7bd95090a75bc68a0d26b8017cc0ae65c1/flang/lib/Optimizer/Passes/Pipelines.cpp#L278
>
> ).
> Currently, if one run the patch with `flang -fc1 -emit-llvm -O2` on the code below the pass is not run and the attribute not added.
>
> ```
> subroutine foo(x)
> call bar(x)
> end subroutine
> ```
Thank you for your review. I'll modify the code so that the path is enabled by default.
After making the changes below, a dozen or so regression tests failed, so I'll confirm them before committing.
```
// Add function attributes
mlir::LLVM::framePointerKind::FramePointerKind framePointerKind;
if (config.FramePointerKind == llvm::FramePointerKind::NonLeaf)
framePointerKind = mlir::LLVM::framePointerKind::FramePointerKind::NonLeaf;
else if (config.FramePointerKind == llvm::FramePointerKind::All)
framePointerKind = mlir::LLVM::framePointerKind::FramePointerKind::All;
else
framePointerKind = mlir::LLVM::framePointerKind::FramePointerKind::None;
pm.addPass(fir::createFunctionAttr(
{framePointerKind, config.NoInfsFPMath, config.NoNaNsFPMath,
config.ApproxFuncFPMath, config.NoSignedZerosFPMath,
config.UnsafeFPMath}));
```
https://github.com/llvm/llvm-project/pull/116182
More information about the flang-commits
mailing list