[llvm-dev] byval vs. explicitly coded copy

Friedman, Eli via llvm-dev llvm-dev at lists.llvm.org
Fri Nov 3 15:44:58 PDT 2017


On 11/3/2017 2:57 PM, Rodney M. Bates via llvm-dev wrote:
> Is there any disadvantage to inserting explicit llvm code in a prolog 
> to copy a
> parameter, rather than putting the 'byval' attribute on the formal or 
> indirect call?
>
> I have an IR that, without some significant work, does not make enough 
> information
> available at an indirect call site to know whether a copy is needed.  
> (The original
> source language knows, it just gets lost at an indirect call.)

It's fine; actually, you'll probably get better code in many cases by 
avoiding byval.  (If you're calling code which uses the C calling 
convention, you might need to use "byval" to match the calling convention.)

-Eli

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project



More information about the llvm-dev mailing list