llvm-project
b11a424e - [flang] Inline trivial scalar allocatable assignments in HLFIR-to-FIR (#183177)

Commit
47 days ago
[flang] Inline trivial scalar allocatable assignments in HLFIR-to-FIR (#183177) For trivial scalar allocatable assignments (non-polymorphic, non-character, non-array, non-temporary), inline the assignment directly instead of calling the `_FortranAAssign` runtime. The inlined code checks whether the allocatable is already allocated: if so, it stores directly; otherwise, it allocates memory via `fir.allocmem`, stores, and updates the box descriptor. The if-branch is necessary to handle both cases: ```fortran integer, allocatable :: k allocate(k) k = 42 ! already allocated: store directly ``` ```fortran integer, allocatable :: k k = 42 ! not allocated: allocmem, store, update box ```
Author
Parents
Loading