<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 - Missing (potentially lots of) optimizations for type c_void* when compared to i8*"
   href="https://bugs.llvm.org/show_bug.cgi?id=36795">36795</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Missing (potentially lots of) optimizations for type c_void* when compared to i8*
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

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

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

        <tr>
          <th>CC</th>
          <td>chandlerc@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>See it live: <a href="https://godbolt.org/g/nNDaWy">https://godbolt.org/g/nNDaWy</a>

This IR using i8*:

define void @call_malloc() #0 {
  %1 = call i8* @malloc(i64 1)
  ret void
}
declare i8* @malloc(i64) #1

optimizes to:

define void @call_malloc() local_unnamed_addr #0 {
  ret void
}
attributes #0 = { norecurse nounwind readnone }

while this IR using an opaque type c_void *:

%struct.c_void = type opaque
define void @call_malloc() #0 {
  %1 = call %struct.c_void* @malloc(i64 1)
  ret void
}
declare %struct.c_void* @malloc(i64) #1

optimizes to:

%struct.c_void = type opaque
define void @call_malloc() local_unnamed_addr #0 {
  %1 = tail call %struct.c_void* @malloc(i64 1)
  ret void
}

declare noalias %struct.c_void* @malloc(i64) local_unnamed_addr #0
attributes #0 = { nounwind }

Note, in particular, that the call to malloc has not been removed.</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>