Hello! I’m studying how llvm.assume statements are internally represented. I can see that llvm can simplify simple arithmetic expressions such as x * (x+1) == 2 used in assumptions and infer x == 1 (x is u32) godbolt, but I wonder where in the codebase this happens.
Assume is used in many places. The above transformation is likely in instcombine or gvn.
The easiest way to find almost all assumption users is to look for the passes that query “AssumptionAnalysis”. Though, some might not actually use assumptions.
Thank you. I also came across ValueTracking, which has an SMT-solver like interface - can one use ValueTracking to reason about arbitrary SSA registers?
I don’t understand the question. I would also recommend to forget about “SSA registers” and treat them as “values”. “registers” often leads to wrong conclusions.
ValueTracking follows def-use chains, but it’s unclear what exactly you are trying to achieve.