[Bug tree-optimization/31873] missed optimization: we don't move "invariant casts" out of loops

2019-03-03 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=31873

Eric Gallager  changed:

   What|Removed |Added

 CC||dberlin at gcc dot gnu.org,
   ||kazu at codesourcery dot com,
   ||roger at eyesopen dot com
   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=25125

--- Comment #3 from Eric Gallager  ---
(In reply to Dorit Naishlos from comment #0)
> This PR was originally opened against PRE (PR25809), but turns out PRE can't
> solve this problem, so here's a new PR instead:
> 
> In testcases that have reduction, like gcc.dg/vect/vect-reduc-2char.c and
> gcc.dg/vect-reduc-2short.c, the following casts appear:
> 
> signed char sdiff;
> unsigned char ux, udiff; 
> sdiff_0 = ...
> loop:
># sdiff_41 = PHI ;
>.
>ux_36 = 
>udiff_37 = (unsigned char) sdiff_41;  
>udiff_38 = x_36 + udiff_37;
>sdiff_39 = (signed char) udiff_38;
> end_loop
> 
> although these casts could be taken out of loop all together. i.e., transform
> the code into something like the following:
> 
> signed char sdiff;
> unsigned char ux, udiff;
> sdiff_0 = ...
> udiff_1 = (unsigned char) sdiff_0;
> loop:
># udiff_3 = PHI ;
>.
>ux_36 = 
>udiff_2 = ux_36 + udiff_3;
> end_loop
> sdiff_39 = (signed char) udiff_2;
> 
> see this discussion thread:
> http://gcc.gnu.org/ml/gcc-patches/2005-12/msg01827.html

thread says this is related to bug 25125; adding that under "See Also"
(also adding some people from the thread on cc)

[Bug tree-optimization/31873] missed optimization: we don't move invariant casts out of loops

2007-05-09 Thread rguenth at gcc dot gnu dot org


--- Comment #1 from rguenth at gcc dot gnu dot org  2007-05-09 10:47 ---
Does it do it if you specify --param lim-expensive=1?  Then it's just a cost
issue.


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||rguenth at gcc dot gnu dot
   ||org, rakdver at gcc dot gnu
   ||dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31873



[Bug tree-optimization/31873] missed optimization: we don't move invariant casts out of loops

2007-05-09 Thread rakdver at gcc dot gnu dot org


--- Comment #2 from rakdver at gcc dot gnu dot org  2007-05-09 11:10 ---
(In reply to comment #1)
 Does it do it if you specify --param lim-expensive=1?  Then it's just a cost
 issue.

no, lim won't do this transformation.  Store motion could probably be persuaded
to do it by a few changes, although I am not quite sure what is the benefit of
moving no-op casts out of the loop. 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31873