<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-load forwarding due to asymmetric alias information"
   href="https://bugs.llvm.org/show_bug.cgi?id=39186">39186</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Missed store-load forwarding due to asymmetric alias 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>jeroen.dobbelaere@synopsys.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=20966" name="attach_20966" title="test.c showing two similar cases, one that gets optimized, one that doesn't">attachment 20966</a> <a href="attachment.cgi?id=20966&action=edit" title="test.c showing two similar cases, one that gets optimized, one that doesn't">[details]</a></span>
test.c showing two similar cases, one that gets optimized, one that doesn't

The attached testcase results in following asymmetric alias relationship
between two stores and one load.
(A) store 42, %0
(B) store 43, %1
(C) load %0

for FOO:
(A)-(B): may alias
(A)-(C): must alias
(B)-(C): no alias (due to __restrict)

for BAR:
(A)-(B): no alias (due to __restrict)
(A)-(C): must alias
(B)-(C): may alias

Content after inlining:

case 'FOO':
  *** IR Dump After Function Integration/Inlining ***
  ; Function Attrs: nounwind uwtable
  define dso_local i32 @foo(i32*, i32*) local_unnamed_addr #0 {
    store i32 42, i32* %0, align 4, !tbaa !2
    store i32 43, i32* %1, align 4, !tbaa !2, !noalias !6
    %3 = load i32, i32* %0, align 4, !tbaa !2, !alias.scope !6
    ret i32 %3
  }

case 'BAR':
  *** IR Dump After Function Integration/Inlining ***
  ; Function Attrs: nounwind uwtable
  define dso_local i32 @bar(i32*, i32*) local_unnamed_addr #2 {
    store i32 42, i32* %0, align 4, !tbaa !2, !alias.scope !6
    store i32 43, i32* %1, align 4, !tbaa !2, !noalias !6
    %3 = load i32, i32* %0, align 4, !tbaa !2
    ret i32 %3
  }

- EarlyCSE is able to optimize foo and see that the load is not necessary.
- EarlyCSE, GVN and NewGVN are not able to optimize bar.

NOTE: gcc is able to optimize both cases</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>