1. A method of compiling a source file, the method implemented with a processor equipped with memory-stored instructions, which when executed by the processor, cause the processor to perform the method, comprising: identifying a first source code segment in a first source file as a potential optimization opportunity, the first source code segment including a first call to a first function; identifying a compilation record storing data indicating that the first source code segment is an actual optimization opportunity, the data being based on a previous compilation of a second source file including a second source code segment that includes a second call to a second function, and the second function being functionally equivalent to the first function and associated with the data; generating a first lower-level representation of the second source file, wherein the generating a first lower-level representation includes marking the second call to the second function as being replaceable with a shared function; generating an optimized representation of the first lower-level representation by replacing the marked second call to the second function with the shared function; and compiling the first source file, wherein compiling the first source file includes generating a second lower-level representation of the first source file in accordance with the actual optimization opportunity by marking the first call to the first function as being replaceable with the shared function, wherein compiling the first source file further includes generating an optimized representation of the second lower-level representation by replacing the marked first call to the first function with the shared function.