This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: what is function cloning?


ranjith kumar <ranjithproxy@gmail.com> writes:

> What is function cloning?

In the context of a compiler, it's when the compiler makes a second
copy of a function with some modification.  For example, if the
compiler discovers that a function is called many different times with
the same initial parameter, it may clone the function to produce a
version which takes one less parameter, and then change all the
callers to call the clone.

Another example is that a compiler may make several clones of a
function and compile them tuned for different microarchitectures, and
then arrange for the appropriate one to be used at runtime based on
some sort of CPU test.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]