> Am 20.10.2023 um 15:47 schrieb Andre Vieira (lists) 
> <andre.simoesdiasvie...@arm.com>:
> 
> 
> 
>> On 20/10/2023 14:41, Richard Biener wrote:
>>> On Fri, 20 Oct 2023, Andre Vieira (lists) wrote:
>>> Hi,
>>> 
>>> This patch stops lowering of bitfields by ifcvt when they have non-constant
>>> offsets as we are not likely to be able to do anything useful with those
>>> during
>>> vectorization.  That also fixes the issue reported in PR 111882, which was
>>> being caused by an offset with a side-effect being lowered, but constants 
>>> have
>>> no side-effects so we will no longer run into that problem.
>>> 
>>> Bootstrapped and regression tested on aarch64-unknown-linux-gnu.
>>> 
>>> OK for trunk?
>> +  if (!TREE_CONSTANT (DECL_FIELD_OFFSET (rep_decl))
>> +      || !TREE_CONSTANT (DECL_FIELD_BIT_OFFSET (rep_decl))
>> +      || !TREE_CONSTANT (ref_offset)
>> +      || !TREE_CONSTANT (DECL_FIELD_BIT_OFFSET (field_decl)))
>> +    return NULL_TREE;
>> DECL_FIELD_BIT_OFFSET is always constant.  Please test
>> TREE_CODE (..) == INTEGER_CST instead of TREE_CONSTANT.
>> OK with those changes.
> After I sent it I realized it would've been nicer to add a diagnostic, you OK 
> with:
> +      if (dump_file && (dump_flags & TDF_DETAILS))
> +       fprintf (dump_file, "\t Bitfield NOT OK to lower,"
> +                           " offset is non-constant.\n");

Sure.

>> Richard.
>>> gcc/ChangeLog:
>>> 
>>>    PR tree-optimization/111882
>>>    * tree-if-conv.cc (get_bitfield_rep): Return NULL_TREE for bitfields
>>>    with
>>>    non-constant offsets.
>>> 
>>> gcc/testsuite/ChangeLog:
>>> 
>>>    * gcc.dg/vect/pr111882.c: New test.
>>> 

Reply via email to