Integer range analysis


I would like to be able to point to a SSA integer variable at a particular point in a LLVM IR program and do some analysis on it, to determine what possible values it could have at that point in the program.
Is there any LLVM tools out there that already do this sort of thing?
Initially, I only need it at the function level context.

Kind Regards


LazyValueInfo may be what you want. (Although I found it is a little bit conservative at back edges)

Attributor has multiple matching code deductions including AAPotentialValues, which collects SSA values that the given one might be equal to, and AAConstantRange, which is a constant integer range for the given value. All inter-procedural, looking through memory, etc.
Let me know if you want to try it or have any problems.