[llvm] [ValueTracking] Handle intrinsics in `computeConstantRange` (PR #100870)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 27 06:51:12 PDT 2024


https://github.com/nikic requested changes to this pull request.

Independent of the specific feedback, I'm rejecting this in principle. See this comment in the doc comment:

> This is intended as a cheap, non-recursive check.

Complex recursive cases are intended to be handled by SCCP or LVI/CVP.

I *am* willing to explore making computeConstantRange() a full-blown recursive analysis, but only if this is done in a principled fashion, and not by adding these things piece-meal, such that each step looks free but we have no insight into the overall cost.

That is, if we want to go in this direction, computeConstantRange() needs to be switched fully to a recursive implementation, so that we can properly evaluate the cost/benefit of doing so. Maybe it's fine. Maybe it's fine if we switch some of the existing calls to use maximum starting depth. Maybe we can get rid of computeConstantRangeIncludingKnownBits() and use *only* computeConstantRange() (possibly having cross-recursion between the two to pick whichever is best for a given opcode).

https://github.com/llvm/llvm-project/pull/100870


More information about the llvm-commits mailing list