For arrays without a constant interior or arrays of character with
dynamic length arrays, the data types are converted to a pointer to the
element type, so the scale size of the constant extents needs to be
counted. The previous AllocaOp conversion does not consider the arrays
of character with dynamic length arrays, and the previous AllocMemOp
conversion does not consider arrays without a constant interior. This
fixes them and refactors the code so that it can be shared. Also add
the test cases.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Thanks for the bug fix
flang/lib/Optimizer/CodeGen/CodeGen.cpp | ||
---|---|---|
382 | We should really try to share this part of the code with fir.allocmem codegen (that may or may not contain this bug, but that is doing very similar logic here: https://github.com/llvm/llvm-project/blob/44e58509be72b49c3abc7b4c5a7ffa81a754fe1c/flang/lib/Optimizer/CodeGen/CodeGen.cpp#L1006). Can you try to share it (a lot more can probably be shared between allocmem and alloca codegen) ? |
Thanks @jeanPerier for the notice. The AllocMemOp does have one similar bug. Also fix it and share the code with AllocaOp.
Thanks a lot @peixin, it is great to have this code shared and to have more regression tests here !
Thanks @jeanPerier . FIR upstream work is not done. So, do I need to cherry-pick and sync this, D124345, and D125022 to fir-dev after landing them considering it may affect the upstream work?
We should really try to share this part of the code with fir.allocmem codegen (that may or may not contain this bug, but that is doing very similar logic here: https://github.com/llvm/llvm-project/blob/44e58509be72b49c3abc7b4c5a7ffa81a754fe1c/flang/lib/Optimizer/CodeGen/CodeGen.cpp#L1006). Can you try to share it (a lot more can probably be shared between allocmem and alloca codegen) ?