Files
swift-mirror/lib/SILPasses/FunctionSignatureOpts.cpp
Michael Gottesman 993d9c54eb [func-sig-opts] If we already made a specialized version of a function, do not respecialize, just bail.
This patch ensures that if we already have a version of a function with
an optimized function signature, we do not turn the original function
into a thunk or change the original function to call the already created
specialized version of it. The reason for doing this is:

1. It enables us to avoid the question of whether or not the callee and
caller properly mesh. To do this safely, we would really need to analyze
the specialized version of the function to make sure that it
meshes. This could be fragile.

2. This situation should not occur often since we only run function
signature specialization once in the pipeline and we do not specialize
external functions (* see below) implying linking will not affect this
optimization.

* We do not specialize functions with external linkage since:

1. Linking in a function to the current module does not provide any more
information about the internals or the signature of the function that
was available in the original module.

2. For function signature optimization to work, we need to be able to
optimize both the caller and the callee. External functions are not
emitted into the final object file implying that any changes we make to
the caller or callee will not be apparent in the final object file. So
we will not get any optimization benefit and could potentially introduce
miscompiles.

Swift SVN r22609
2014-10-09 00:50:07 +00:00

23 KiB