[Bug tree-optimization/63586] x+x+x+x -> 4*x in gimple
glisse at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Dec 4 07:32:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63586
--- Comment #4 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to kugan from comment #2)
> ;; Function f4 (f4, funcdef_no=3, decl_uid=4162, cgraph_uid=3,
> symbol_order=3)
>
> ;; 1 loops found
> ;;
> ;; Loop 0
> ;; header 0, latch 1
> ;; depth 0, outer -1
> ;; nodes: 0 1 2
> ;; 2 succs { 1 }
> f4 (unsigned int x, unsigned int z, unsigned int k)
> {
> unsigned int y;
> unsigned int reassocmul_12;
> unsigned int reassocmul_13;
> unsigned int _14;
> unsigned int _15;
>
> <bb 2>:
> reassocmul_12 = x_2(D) * 3;
> reassocmul_13 = z_6(D) * 3;
> _14 = x_2(D) + reassocmul_13;
> _15 = _14 + reassocmul_12;
> y_10 = _15 + k_1(D);
> return y_10;
>
> }
So the patch fails in this case? It misses the 4th x.
(In reply to kugan from comment #3)
> I think the intention is to have multiplication by power-of-2?
At gimple level, multiplication by any constant would be a good
canonicalization (it can be expanded back to sums later if that's what the
target prefers).
More information about the Gcc-bugs
mailing list