[PATCH] Update optimization passes to handle inalloca arguments

Reid Kleckner rnk at google.com
Fri Dec 20 09:54:22 PST 2013


Sure!  The motivation is to properly implement non-trivial pass-by-value
arguments in the Microsoft C++ ABI.  Without inalloca, it's impossible to
represent the desired behavior in LLVM IR.  Specifically, we need to be
able to call copy constructors on outgoing argument memory, or even better,
elide the copy altogether and sret into it.

There's a longer document here:
http://llvm.org/docs/InAlloca.html

I think this bug covers it the best:
http://llvm.org/bugs/show_bug.cgi?id=5064


On Fri, Dec 20, 2013 at 9:42 AM, Philip Reames <listmail at philipreames.com>wrote:

>  Reid,
>
> Out of curiosity, what's the motivation behind inalloca?  I found your
> update to the documentation which described their semantics, but I didn't
> find any discussion of when "inalloc" parameters would actually be useful.
> Could you point me to the appropriate discussion thread?  Just trying to
> understand the motivation for the changes.
>
> Philip
>
>
> On 12/19/13 2:43 PM, Reid Kleckner wrote:
>
> I searched Transforms/ and Analysis/ for 'ByVal' and updated those call
> sites to check for inalloca if appropriate.
>
> I added tests for any change that would allow an optimization to fire on
> inalloca.
> http://llvm-reviews.chandlerc.com/D2449
>
> Files:
>   include/llvm/IR/Argument.h
>   include/llvm/IR/Instructions.h
>   include/llvm/Support/CallSite.h
>   lib/Analysis/MemoryBuiltins.cpp
>   lib/Analysis/ValueTracking.cpp
>   lib/IR/Function.cpp
>   lib/IR/Instructions.cpp
>   lib/Transforms/IPO/ArgumentPromotion.cpp
>   lib/Transforms/IPO/DeadArgumentElimination.cpp
>   lib/Transforms/IPO/FunctionAttrs.cpp
>   lib/Transforms/IPO/IPConstantPropagation.cpp
>   lib/Transforms/InstCombine/InstCombineCalls.cpp
>   lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
>   lib/Transforms/ObjCARC/ObjCARC.h
>   lib/Transforms/Scalar/DeadStoreElimination.cpp
>   test/Transforms/ArgumentPromotion/inalloca-2.ll
>   test/Transforms/ArgumentPromotion/inalloca.ll
>   test/Transforms/DeadStoreElimination/simple.ll
>   test/Transforms/FunctionAttrs/readattrs.ll
>
>
>
> _______________________________________________
> llvm-commits mailing listllvm-commits at cs.uiuc.eduhttp://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131220/6ff6cd00/attachment.html>


More information about the llvm-commits mailing list