[PATCH] Fix endless loop in find_single_def_src (PR rtl-optimization/93088)

Eric Botcazou ebotcazou@adacore.com
Fri Jan 3 09:05:00 GMT 2020


> While we could add some hash_table/bitmap or whatever other data structure
> to track registers we've already looked at, having unbounded look through
> register copies looks dangerous to me for compile time complexity in
> pathological cases, and while on certain architectures I could understand
> very deep chains of say reg2 = reg1 + constant; reg3 = reg2 + constant; ...
> (or with post-increment/decrement/modify) if the target addressing mode
> doesn't allow suitable immediates in addresses, having chains of simple
> reg2 = reg1; reg3 = reg2; reg4 = reg3; reg5 = reg4; ...
> chains with thousands copies will unlikely appear and would unlikely result
> in something useful for the loop iv optimization, so this patch instead
> just looks through at most 128 copies (I don't think we need a param for
> that).
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
> 
> 2020-01-03  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR rtl-optimization/93088
> 	* loop-iv.c (find_single_def_src): Punt after looking through
> 	128 reg copies for regs with single definitions.  Move definitions
> 	to first uses.
> 
> 	* gcc.target/i386/pr93088.c: New test.

OK with me, thanks.

-- 
Eric Botcazou



More information about the Gcc-patches mailing list