On Wed, Mar 27, 2024 at 01:42:03PM +0100, Richard Biener wrote: > The comment says it was added for (char)_Bool, probably > gcc.dg/tree-ssa/vce-1.c will fail. But I'm not sure this optimization > is important, it seems early SRA introduces a V_C_E here and then > phiopt the conversion to unsigned char. But this is a V_C_E of > _Bool -> unsigned char -> _Bool. We seem to apply both this > pattern and then drop the V_C_E. > > Maybe we can reasonably optimize the case where type == TREE_TYPE (@1) > and the intermediate precision is bigger or equal?
If type is INTEGRAL_TYPE_P and has TYPE_PRECISION <= that of TREE_TYPE (@1), sure, it can be optimized whenever TREE_TYPE (@0) has precision >= that, no matter what TYPE_SIGN TREE_TYPE (@1) has. Anyway, will try to cook up something. Jakub