[all-commits] [llvm/llvm-project] af5d3a: [flang] Improve disjoint/identical slices recognit...

Slava Zakharin via All-commits all-commits at lists.llvm.org
Fri Dec 13 13:08:24 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: af5d3afff54e5af61f384a1e95020f0a0374caec
      https://github.com/llvm/llvm-project/commit/af5d3afff54e5af61f384a1e95020f0a0374caec
  Author: Slava Zakharin <szakharin at nvidia.com>
  Date:   2024-12-13 (Fri, 13 Dec 2024)

  Changed paths:
    M flang/lib/Optimizer/HLFIR/Transforms/OptimizedBufferization.cpp
    M flang/test/HLFIR/opt-array-slice-assign.fir

  Log Message:
  -----------
  [flang] Improve disjoint/identical slices recognition in opt-bufferization. (#119780)

The changes are needed to be able to optimize
'x(9,:)=SUM(x(1:8,:),DIM=1)'
without a temporary array. This pattern exists in exchange2.

The patch also fixes an existing problem in Flang with this test:
```
program main
  integer :: a(10) = (/1,2,3,4,5,6,7,8,9,10/)
  integer :: expected(10) = (/1,10,9,8,7,6,5,4,3,2/)
  print *, 'INPUT: ', a
  print *, 'EXPECTED: ', expected
  call test(a, 10, 2, 10, 9)
  print *, 'RESULT: ', a
contains
  subroutine test(a, size, x, y, z)
    integer :: x, y, z, size
    integer :: a(:)
    a(x:y:1) = a(z:x-1:-1) + 1
  end subroutine test
end program main
```



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