[PING^2][PATCH][2 of 2] RTL expansion for zero sign extension elimination with VRP

Richard Biener rguenther@suse.de
Tue Jan 7 12:24:00 GMT 2014

On Tue, 7 Jan 2014, Kugan wrote:

> ping ?
> I have reorganised the last patch and now handling only
> VIEW_CONVERT_EXPR, CONVERT_EXPR and NOP_EXPR. Once it is reviewed and
> necessary changes are made, I will address the other cases as a separate
> patch (when it reaches that stage).

Note that VIEW_CONVERT_EXPR is wrong here.  I think you are
handling this wrong still.  From a quick look you want to avoid
the actual promotion for

  reg_1 = ....

when reg_1 is promoted and thus the target is (subreg:XX N).
The RHS has been expanded in XXmode.  Dependent on the value-range
of reg_1 you want to set N to a paradoxical subreg of the expanded
result.  You can always do that if the reg is zero-extended
and else if the MSB is not set for any of the values of reg_1.
I don't see how is_assigned_exp_fit_type reflects this in any way.

Anyway, the patch should not introduce another if (promoted)
case but only short-cut the final convert_move call of the existing


> Thanks,
> Kugan
> gcc/
> +2014-01-07  Kugan Vivekanandarajah  <kuganv@linaro.org>
> +
> +	* dojump.c (do_compare_and_jump): Generate rtl without
> +	zero/sign extension if redundant.
> +	* cfgexpand.c (expand_gimple_stmt_1): Likewise.
> +	(is_assigned_exp_fit_type) : New function.
> +	* cfgexpand.h (is_assigned_exp_fit_type) : Declare.
> +

Richard Biener <rguenther@suse.de>
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imend"orffer

More information about the Gcc-patches mailing list