Fix OpenMP simdclone call codegen for array results
Corrects an accounting error in OpenMP simdclone calls when the result type differs from the vector type, specifically for array cases.
A code generation issue in OpenMP simdclone calls has been fixed. When the result type of a simdclone call differs from the vector type used internally, the compiler needs to materialize a vector constructor (CTOR). The previous implementation incorrectly accounted for this CTOR, particularly in array scenarios. This commit simplifies that accounting to resolve the bug and includes a new test case.
In Details
This commit addresses a bug in vectorizable_simd_clone_call within tree-vect-stmts.cc. Specifically, when emitting a simdclone call where the result type is an array and differs from the chosen vector type, the accounting for the materialized vector CTOR was incorrect. The change simplifies this accounting logic to fix the issue, alongside a new test case (vect-simd-21.c).
- simdclone
- A compiler intrinsic or construct related to OpenMP SIMD operations. It likely involves cloning or adapting code for SIMD execution, possibly handling cases where the target SIMD vector width differs from the desired operation width.
- Vector CTOR
- A constructor for a vector type. In the context of GCC's intermediate representation (GIMPLE or Tree), this refers to the code generated to create or initialize a vector data type, often used when converting between different vector representations or types.
- Tree Optimization
- A phase in the GCC compiler pipeline that operates on an intermediate representation called 'tree'. This phase performs various optimizations, including loop transformations, constant propagation, and vectorization, before the code is lowered to GIMPLE or machine code.