<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 Store forwarding optimization as the Alias analysis failed to establish "noalias" information."
   href="https://bugs.llvm.org/show_bug.cgi?id=44318">44318</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Missed Store forwarding optimization as the Alias analysis failed to establish "noalias" information.
          </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>Windows NT
          </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>venkataramanan.kumar.llvm@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Please consider the following test case.

---Snip--
struct B {
   int b1;
   int b2;
 };

 struct C {
  int b1;
 };

 struct A {
  int a1;
  struct C SC;
  int a2;
 };

 int foo1(struct A * Aptr, struct B* Bptr)
 {
    int *a = &Aptr->SC.b1;
    *a=10;
    Bptr->b1 = 11;
    return *a;
 }

 int foo2(struct A * Aptr, struct B* Bptr)
 {
    Aptr->SC.b1=10;
    Bptr->b1 = 11;
    return Aptr->SC.b1;
}
---Snip--

For the function "foo1" return value is 10 and can be forwarded directly. 
The alias analysis is not able establish the fact that memory accessed by "*a" 
and "Bptr->b1" donot alias each other. 
Hence the optimization is missed.  There is no TBAA information formed for
"&Aptr->SC.b1" and we are not able to prove "noalias" using TBAA.

But for the function "foo2", the Alias analysis proved that "Aptr->SC.b1" and
"Bptr->b1" donot alias each other. TBAA has proper metadata for both the memory
accesses in this case. Here the return value is forwarded.</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>