https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119107
Bug ID: 119107
Summary: inconsistent elimination of redundant *_extend
operations
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: rearnsha at gcc dot gnu.org
Target Milestone: ---
GCC often relies on combine to identify and eliminate redundant
(zero|sign)_extend operations. This makes the process somewhat fragile. An
example is gcc.target/arm/unsigned-extend-1.c, which passes in Arm state, or
when generating thumb2 code, but fails when generating thumb1 (because it would
require combine to examine about 5 instructions to find a valid
simplification).
We should consider having a pass that does this, or perhaps type widening, more
consistently so that we are less reliant on specific sequences to eliminate
redundant extends. It could perhaps be done at the tree level, for best
consistency, but would need to be deferred until after we had decided code
could not be vectorized.