[all-commits] [llvm/llvm-project] ef4fb1: [flang][hlfir] Resolve shape_of users when bufferi...
khaki3 via All-commits
all-commits at lists.llvm.org
Wed Jun 3 06:51:47 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: ef4fb183a8d5c0d1910f7b5b6776ba669d6795ef
https://github.com/llvm/llvm-project/commit/ef4fb183a8d5c0d1910f7b5b6776ba669d6795ef
Author: khaki3 <47756807+khaki3 at users.noreply.github.com>
Date: 2026-06-03 (Wed, 03 Jun 2026)
Changed paths:
M flang/lib/Optimizer/HLFIR/Transforms/OptimizedBufferization.cpp
M flang/test/HLFIR/opt-bufferization-eval_in_mem.fir
Log Message:
-----------
[flang][hlfir] Resolve shape_of users when bufferizing eval_in_mem (#201214)
A follow-up to #197814.
Example:
```fortran
bmat = matmul(mat, mat) ! bmat is allocatable
```
In this code, `SeparateAllocatableAssign` sizes the reallocation with an
`hlfir.shape_of` of the RHS. Once the `matmul` is lowered to
`hlfir.eval_in_mem`, that `shape_of` is an extra user, so
`EvaluateIntoMemoryAssignBufferization` erases the `eval_in_mem` while
it's still used, hitting a `use-after-erase` assertion at `-O2`.
Fix: in `OptimizedBufferization`, redirect a `shape_of` user to the
`eval_in_mem`'s shape operand before erasing it.
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