tree-optimization/102659 - really avoid undef overflow in if-conversion
authorRichard Biener <rguenther@suse.de>
Thu, 14 Oct 2021 07:00:25 +0000 (09:00 +0200)
committerRichard Biener <rguenther@suse.de>
Thu, 14 Oct 2021 12:58:40 +0000 (14:58 +0200)
commit9b2ad21ab3ebc21a3408108327fa1a7cbedaf217
treed68d7cfd68cb20de58c40eed4a9702a27434701d
parent4cb52980e5d5fb64a393d385923da1b51ab34606
tree-optimization/102659 - really avoid undef overflow in if-conversion

This plugs the remaining hole of POINTER_PLUS_EXPR with undefined
overflow.  Unfortunately we have to go through some lengths to
not put invariant conversions into the loop body since that confuses
the vectorizers gather/scatter discovery which relies on identifying
an invariant component of plus and minus expressions.  We can
emit those in the loop preheader but then we have to accept that
being non-empty when looking for the LOOP_VECTORIZED internal
function call in the vectorizer.

2021-10-14  Richard Biener  <rguenther@suse.de>

PR tree-optimization/102659
* tree-if-conv.c (if_convertible_gimple_assign_stmt_p): Also
rewrite pointer typed undefined overflow operations.
(predicate_statements): Likewise.  Make sure to emit invariant
conversions in the preheader.
* tree-vectorizer.c (vect_loop_vectorized_call): Look through
non-empty preheaders.
* tree-data-ref.c (dr_analyze_indices): Strip useless
conversions to the MEM_REF base type.
gcc/tree-data-ref.c
gcc/tree-if-conv.c
gcc/tree-vectorizer.c