[all-commits] [llvm/llvm-project] a0d699: Reland "[flang] Added noalias attribute to functio...

Slava Zakharin via All-commits all-commits at lists.llvm.org
Thu May 29 13:43:43 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a0d699a8e686cba99690cf28463d14526c5bfbc8
      https://github.com/llvm/llvm-project/commit/a0d699a8e686cba99690cf28463d14526c5bfbc8
  Author: Slava Zakharin <szakharin at nvidia.com>
  Date:   2025-05-29 (Thu, 29 May 2025)

  Changed paths:
    M flang/include/flang/Optimizer/Transforms/Passes.td
    M flang/lib/Optimizer/Passes/Pipelines.cpp
    M flang/lib/Optimizer/Transforms/FunctionAttr.cpp
    M flang/test/Fir/array-coor.fir
    M flang/test/Fir/arrayset.fir
    M flang/test/Fir/arrexp.fir
    M flang/test/Fir/box-offset-codegen.fir
    M flang/test/Fir/box-typecode.fir
    M flang/test/Fir/box.fir
    M flang/test/Fir/boxproc.fir
    M flang/test/Fir/commute.fir
    M flang/test/Fir/coordinateof.fir
    M flang/test/Fir/embox.fir
    M flang/test/Fir/field-index.fir
    M flang/test/Fir/ignore-missing-type-descriptor.fir
    M flang/test/Fir/polymorphic.fir
    M flang/test/Fir/rebox.fir
    M flang/test/Fir/struct-passing-x86-64-byval.fir
    M flang/test/Fir/target-rewrite-complex-10-x86.fir
    M flang/test/Fir/target.fir
    M flang/test/Fir/tbaa-codegen.fir
    M flang/test/Fir/tbaa-codegen2.fir
    M flang/test/Integration/OpenMP/copyprivate.f90
    M flang/test/Integration/debug-local-var-2.f90
    M flang/test/Integration/unroll-loops.f90
    M flang/test/Lower/HLFIR/unroll-loops.fir
    M flang/test/Lower/forall/character-1.f90
    M flang/test/Transforms/constant-argument-globalisation.fir
    A flang/test/Transforms/function-attrs-noalias.fir
    M flang/test/Transforms/function-attrs.fir

  Log Message:
  -----------
  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.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list