<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - missed opportunities in reassociation or instcombine"
   href="http://llvm.org/bugs/show_bug.cgi?id=22357">22357</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>missed opportunities in reassociation or instcombine
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Scalar Optimizations
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>wujingyue@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=13742" name="attach_13742" title="IR for the example">attachment 13742</a> <a href="attachment.cgi?id=13742&action=edit" title="IR for the example">[details]</a></span>
IR for the example

void foo(int a, int b, int c, int *x, int *y) {
  *x = (a + b);
  *y = (a + 2) + b;
}

I would love to see the above example be optimized to:

void foo(int a, int b, int c, int *x, int *y) {
  int t = a + b;
  *x = t;
  int t2 = t + 2;
  *y = t2;
}

However, this is not happening with the current LLVM.

I wonder how we can add this enhancement. It seems related to reassociation,
instcombine, and maybe even GVN? 

Jingyue</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>