Instruction comparison

I am looking at making my recompilation analysis smarter by
automatically detecting which functions have changed from one source
code modification to the next. So, I have one Module representing the
original code, and another module representing the new code.

I think it's fairly straight forward to match functions and global
variables between these modules. However, mathching functions for
equality , or just trying to detect if they are still the same, seems to
be quite difficult. It seems that I cannot use a simple heuristic of
testing opcode or number of params, etc. because I must also detect very
subtle changes, like the changing of a constant.

Are there any supports in llvm for drawing conclusions about equivalence
of instructions or functions.

Or, is it possible to be certain of equality just by looking at
per-instruction properties and ignoring the problem of proving
equivalence of the instructions supplying the values to the current
instruction.

Thanks,
James

Or, is it possible to be certain of equality just by looking at
per-instruction properties and ignoring the problem of proving
equivalence of the instructions supplying the values to the current
instruction.

The answer to your overall question is: No. There is no easy way to check
for equivalence.

What you really want to check for is whether the SSA graphs defined by a
function are isomorphic to each other. In this case, I think the problem
is restricted enough to make it possible to do in linear time (you have
roots), but it's still non-trivial to code up.

Is analysis time really that much of a problem?

-Chris