[LLVMdev] Optimizing out redundant alloca involving byval params

Mircea Trofin mtrofin at google.com
Thu Mar 5 15:51:28 PST 2015

Hello all,

I'm trying to find the pass that would convert from:

define void @main(%struct* byval %ptr) {
  %val = load %struct* %ptr
  %val.ptr = alloca %struct
  store %struct %val, %struct* %val.ptr
  call void @extern_func(%struct* byval %val.ptr)
  ret void

to this:
define void @main(%struct* byval %ptr) {
  call void @extern_func(%struct* byval %ptr)
  ret void

First, am I missing something - would this be a correct optimization?

Thank you,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150305/b270efd5/attachment.html>

More information about the llvm-dev mailing list