This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/43037] New: re-association doesn't handle multiple uses with constant operands


int a, b;
void foo (int i, int x)
{
  int j, k, l;
  j = i * x;
  j = j * 5;
  k = j * 3;
  l = j * 4;
  a = k;
  b = l;
}

  j_3 = i_1(D) * 5;
  j_4 = j_3 * x_2(D);
  k_5 = j_4 * 3;
  l_6 = j_4 * 4;

should be re-associated and simplified to

  D.1_3 = i_1(D) * x_2(D);
  k_5 = D.1_3 * 15;
  l_6 = D.1_3 * 20;

note that this requires a value that is not computed previously and thus
is only profitable if all uses of j_4 will be dead after the transformation
unless it is possible to compute j_4 in terms of the new value with the
same number of operations.


-- 
           Summary: re-association doesn't handle multiple uses with
                    constant operands
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]