<div dir="ltr"><div><div><div><div><div><div><div><div>For my project, the step of using LLVM to optimize and generate machine code for a module is much slower than everything else. I realize a significant performance improvement if I can do "incremental compilation" and avoid invoking the LLVM code generator if the underlying object has not changed.<br><br></div>My current strategy is as follows: for each module:<br></div>- write bitcode out to "module.bc.new"<br></div>- if "module.bc" exists, then compare (byte-by-byte) with "module.bc.new".  If they match, then skip compilation<br></div>- move "module.bc.new" to "module.bc" (known to be different at this point)<br></div>- generate "module.o" (expensive step)<br><br></div>However, I am finding that occasionally I will write out different bitcode for the same input, which causes gratuitous recompilation.  If I run llvm-dis on "module.bc" and "module.bc.new" in these cases, the output is identical, as expected.<br><br></div>Is it expected that the actual bitcode may change from run to run, perhaps as a result of ASLR?<br><br></div>Is there a better way for me to check that a Module* structure just built is (not) identical to that from a previous run?<br><br></div>