[PATCH] Fix iv_number_of_iterations (PR rtl-optimization/55838)

Zdenek Dvorak rakdver@iuuk.mff.cuni.cz
Thu Jan 3 09:01:00 GMT 2013


Hi,

> When one (or both) IVs have extend_mode wider than mode, but step doesn't
> fit into mode (the IV is
> (subreg:MODE (plus:EXTEND_MODE base (mult:EXTEND_MODE i step)) lowpart)
> ), such as for EXTEND_MODE SImode, MODE QImode and step e.g. 129, 128, 256
> or 517, iv_number_of_iterations can create invalid rtl.  I think it is safe
> to just use the lowpart subreg of the step.  The second hunk isn't enough,
> we use iv0.step resp. iv1.step directly in several other places in the
> routine, and the first hunk IMHO isn't enough either, if for the above
> extend_mode SI and mode QI iv1.step is 128, the first hunk will make -128 out of
> it, but then we negate it and get step 128 out of it again, not valid QImode
> CONST_INT, and use it e.g. as argument to UMOD.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

I think this is ok,

Zdenek



More information about the Gcc-patches mailing list