<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 --- - aggregate store isn't optimized properly"
   href="http://llvm.org/bugs/show_bug.cgi?id=16316">16316</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>aggregate store isn't optimized properly
          </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>All
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </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>deadalnix@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>Code below can't be optimized further by LLVM :

%A__vtbl = type { i8*, i32 (%A*)* }
%A = type { %A__vtbl* }

@A__vtblZ = constant %A__vtbl { i8* null, i32 (%A*)* @A.foo }
@A__initZ = constant %A { %A__vtbl* @A__vtblZ }

define i32 @_Dmain() {
body:
  %0 = tail call i8* @_d_allocmemory(i64 8)
  %1 = bitcast i8* %0 to %A*
  ; %optimized = bitcast i8* %0 to %A__vtbl**
  ; store %A__vtbl* @A__vtblZ, %A__vtbl** %optimized, align 8
  store %A { %A__vtbl* @A__vtblZ }, %A* %1, align 8
  %2 = getelementptr inbounds %A* %1, i32 0, i32 0
  %vtbl.i = load %A__vtbl** %2, align 8
  %3 = getelementptr inbounds %A__vtbl* %vtbl.i, i64 0, i32 1
  %4 = load i32 (%A*)** %3, align 8
  %5 = tail call i32 %4(%A* %1)
  ret i32 %5
}

define i32 @A.foo(%A* nocapture %this) nounwind readnone {
body:
  ret i32 42
}

declare i8* @_d_allocmemory(i64)

I the store is replaced by the commented code just above, the LLVM is able to
do its job and optimize the virtual call, inline and directly return 42.</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>