Rodney M. Bates via llvm-dev
2017-Nov-03 21:57 UTC
[llvm-dev] byval vs. explicitly coded copy
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.) -- Rodney Bates rodney.m.bates at acm.org
Friedman, Eli via llvm-dev
2017-Nov-03 22:44 UTC
[llvm-dev] byval vs. explicitly coded copy
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