llvm-project/flang/test
Diana Picus 776d0ed632 [flang] Fix overallocation by fir-to-llvm-ir pass
When converting a fir.alloca of an array to the LLVM dialect, we used to
multiply the allocated size by all the constant factors encoded in the
array type. This is fine when the array type is converted to the element
type for the purposes of the allocation, but if it's converted to an
array type, then we might be allocating too much space. For example, for
`%2 = fir.alloca !fir.array<8x16x32xf32>, %0, %1` we would allocate
%0 * %1 * 8 * 16 * 32 x llvm.array<32 x array<16 * array<8 x f32>>>. We
really only need to allocate %0 * %1 such arrays.

This patch fixes the issue by taking note of the array type that we're
trying to allocate. It tries to match the behaviour of
LLVMTypeConverter::convertPointerLike, which returns a pointer to the
element type only when the array type doesn't have a constant interior.
We consequently only multiply with the constant factors in the array
type if the array type doesn't have a constant interior.

This has the nice side effect that it gets rid of some redundant
multiplications with the constant 1 in some cases.

Differential Revision: https://reviews.llvm.org/D116926
2022-01-12 10:08:50 +00:00
..
Driver [flang] Make the frontend driver error out when requesting multiple actions 2021-12-17 10:05:28 +00:00
Evaluate [flang] Do not lose call in shape inquiry on function reference 2022-01-10 19:10:48 +01:00
Examples [flang][flang-omp-report] Remove the loop workarounds for nowait clause 2021-11-04 14:23:50 +00:00
Fir [flang] Fix overallocation by fir-to-llvm-ir pass 2022-01-12 10:08:50 +00:00
Frontend [flang] Make the frontend driver error out when requesting multiple actions 2021-12-17 10:05:28 +00:00
Lower [flang] Make the frontend driver error out when requesting multiple actions 2021-12-17 10:05:28 +00:00
NonGtestUnit [flang] Run non-gtest unit tests with lit. 2020-07-24 14:49:39 +01:00
Parser [flang] Catch mismatched parentheses in prescanner 2021-10-06 14:00:15 -07:00
Preprocessing [flang][nfc] Add a regression test for #50993 2021-08-02 18:21:23 +00:00
Runtime Reland "[flang] GET_COMMAND_ARGUMENT runtime implementation" 2021-09-28 12:34:07 +00:00
Semantics [flang][OpenMP] Add some semantic checks for threadprivate and declare target directives 2022-01-06 20:00:16 +08:00
Unit [flang] unit test support for out-of-tree and in-tree using google tests framework 2020-06-15 22:09:56 +05:30
CMakeLists.txt [Flang] Replace notifyMatchFailure with TODO hard failures 2021-12-02 10:25:02 +00:00
lit.cfg.py [Flang] Replace notifyMatchFailure with TODO hard failures 2021-12-02 10:25:02 +00:00
lit.site.cfg.py.in [flang] Refine output file generation 2021-08-21 15:18:48 +00:00