[all-commits] [llvm/llvm-project] 887783: [flang][runtime] Invert component/element loops in...

Peter Klausler via All-commits all-commits at lists.llvm.org
Thu Jan 25 14:05:48 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 887783e0caab3983f3e32077a7eb137831e1e2e7
      https://github.com/llvm/llvm-project/commit/887783e0caab3983f3e32077a7eb137831e1e2e7
  Author: Peter Klausler <35819229+klausler at users.noreply.github.com>
  Date:   2024-01-25 (Thu, 25 Jan 2024)

  Changed paths:
    M flang/runtime/assign.cpp

  Log Message:
  -----------
  [flang][runtime] Invert component/element loops in assignment (#78341)

The general implementation of intrinsic assignment of derived types in
the runtime support library has a doubly-nested loop: an outer loop that
traverses the components and inner loops than traverse the array
elements. It's done this way to amortize the per-component overhead.
However, this turns out to be wrong when the program cares about the
order in which defined assignment subroutines are called; the Fortran
standard allows less latitude here than we need to invert the ordering
in this way when any component is itself an array. So invert the two
loops: traverse the array elements, and for each element, traverse its
components.




More information about the All-commits mailing list