[llvm-commits] [llvm] r38506 - in /llvm/trunk: lib/VMCore/Verifier.cpp test/Verifier/byval-1.ll test/Verifier/byval-2.ll test/Verifier/byval-3.ll test/Verifier/byval-4.ll

Duncan Sands baldrick at free.fr
Tue Jul 17 06:00:47 PDT 2007


Hi Chris,

> This won't work.  Unlike struct return, the callee actually can  
> notice if this happens.  For example, consider this:
...
> If it were really undefined, this would require the callee to make a  
> copy of the struct before passing it in.  In order to get decent  
> codegen, this copy would have to be eliminated somehow in the codegen  
> stages (because it would be to the wrong location).  Thus, we'd get  
> bad/ugly codegen.

as I mentioned later in my email, in order to get C by-copy semantics
you have to introduce an explicit copy in the IR as you note here.  I
was hoping that on platforms that don't need it it wouldn't be too hard
to remove the useless copy, but I'm starting to get worried that that's
maybe not so easy...

> These are advantages, but despite the hyperbole, I don't think the  
> advantages are that significant.  The inliner needs to be updated,  
> the generic code needs to default to lowering byval arguments as a  
> copy to a temporary, and passing its address, but otherwise it is  
> pretty straight-forward.  It isn't even clear that alias analysis  
> needs to change.

Sorry about the hyperbole, I get carried away sometimes.

Ciao,

Duncan.



More information about the llvm-commits mailing list