On Nov 25, 2007, at 4:48 AM, Duncan Sands wrote: >> I think that getOrInsertFunction should just return the function (not >> a bitcast) if the function type other than the attributes are the >> same. > > once PR1146 is done, what should happen here? Suppose the new > function > and the old differ in some essential attribute (eg: byval). It won't > be possible to bitcast the old function to the new function anymore > because the attributes will no longer be part of the type...
I think everything will be fine. Consider what happens today: If you use getOrInsertFunction(..) then make a call to it, one of two things happen: 1. the callee doesn't exist or does and matches your expectation. Everything is cool. 2. The callee exists and doesn't match your expectation (e.g. takes too many, two few, or wrong arguments). In this case, we return a bitcast of the function so that the callee can create the call without aborting, but the generated code is quite likely to not work right. I think that mismatched/unexpected attributes are just another case of #2. In practice however, getOrInsertFunction is only used for very simple "c" functions, so I don't think that byval etc will come up very often. -Chris _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits