<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 --- - Instcombine removes inalloca flag from alloca instruction"
   href="http://llvm.org/bugs/show_bug.cgi?id=19569">19569</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Instcombine removes inalloca flag from alloca instruction
          </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>david.majnemer@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>consider:
; ModuleID = '<stdin>'
target datalayout = "e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32"
target triple = "i686-pc-windows-msvc"

%struct.gfx_size = type { i32, i32 }

; Function Attrs: nounwind
define void @"\01?doit@@YAXAAUgfx_size@@@Z"(%struct.gfx_size* %a) #0 {
entry:
  %inalloca.save = call i8* @llvm.stacksave()
  %argmem = alloca inalloca <{ %struct.gfx_size }>
  %0 = getelementptr inbounds <{ %struct.gfx_size }>* %argmem, i32 0, i32 0
  %1 = bitcast %struct.gfx_size* %0 to i8*
  %2 = bitcast %struct.gfx_size* %a to i8*
  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %1, i8* %2, i32 8, i32 4, i1 false)
  call void @"\01?f@@YAXUgfx_size@@@Z"(<{ %struct.gfx_size }>* inalloca
%argmem)
  call void @llvm.stackrestore(i8* %inalloca.save)
  ret void
}

declare void @"\01?f@@YAXUgfx_size@@@Z"(<{ %struct.gfx_size }>* inalloca) #1

; Function Attrs: nounwind
declare i8* @llvm.stacksave() #2

; Function Attrs: nounwind
declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture readonly,
i32, i32, i1) #2

; Function Attrs: nounwind
declare void @llvm.stackrestore(i8*) #2

attributes #0 = { nounwind "less-precise-fpmad"="false"
"no-frame-pointer-elim"="false" "no-infs-fp-math"="false"
"no-nans-fp-math"="false" "stack-protector-buffer-size"="8"
"unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="false"
"no-infs-fp-math"="false" "no-nans-fp-math"="false"
"stack-protector-buffer-size"="8" "unsafe-fp-math"="false"
"use-soft-float"="false" }
attributes #2 = { nounwind }

!llvm.ident = !{!0}

!0 = metadata !{metadata !"clang version 3.5.0 "}

running with ~/llvm/build/bin/opt -instcombine shows that we will produce the
following IR:
define void @"\01?doit@@YAXAAUgfx_size@@@Z"(%struct.gfx_size* %a) #0 {
entry:
  %argmem = alloca i64, align 8
  %tmpcast = bitcast i64* %argmem to <{ %struct.gfx_size }>*
  %0 = bitcast %struct.gfx_size* %a to i64*
  %1 = load i64* %0, align 4
  store i64 %1, i64* %argmem, align 8
  call void @"\01?f@@YAXUgfx_size@@@Z"(<{ %struct.gfx_size }>* inalloca
%tmpcast) #2
  ret void
}

note that we have removed the inalloca marker from our alloca instruction,
dooming the call to @"\01?f@@YAXUgfx_size@@@Z"</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>