[Bug tree-optimization/94269] widening_mul should consider block frequency

2020-03-26 Thread cvs-commit at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94269

--- Comment #2 from CVS Commits  ---
The master branch has been updated by Richard Biener :

https://gcc.gnu.org/g:d21dff5b4fee51ae432143065bededfc763dc344

commit r10-7391-gd21dff5b4fee51ae432143065bededfc763dc344
Author: Richard Biener 
Date:   Thu Mar 26 08:33:57 2020 +0100

widening_mul: restrict ops to be defined in the same basic-block when
convert plusminus to widen

In the testcase for PR94269, widening_mul moves two multiply
instructions from outside the loop to inside
the loop, merging with two add instructions separately.  This
increases the cost of the loop.  Like FMA detection
in the same pass, simply restrict ops to be defined in the same
basic-block to avoid possibly moving multiply
to a different block with a higher execution frequency.

2020-03-26  Felix Yang  

PR tree-optimization/94269
* tree-ssa-math-opts.c (convert_plusminus_to_widen): Restrict
this
operation to single basic block.

* gcc.dg/pr94269.c: New test.

[Bug tree-optimization/94269] widening_mul should consider block frequency

2020-03-23 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94269

Richard Biener  changed:

   What|Removed |Added

   Last reconfirmed||2020-03-23
 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1

--- Comment #1 from Richard Biener  ---
Or even simpler like FMA detection which restricts ops to be defined in the
same basic-block:

  /* For now restrict this operations to single basic blocks.  In theory
 we would want to support sinking the multiplication in
 m = a*b;
 if ()
   ma = m + c;
 else
   d = m;
 to form a fma in the then block and sink the multiplication to the
 else block.  */
  if (gimple_bb (use_stmt) != gimple_bb (mul_stmt))
return false;