[llvm] [ValueTracking] Try to infer range of select from true and false values. (PR #68256)

Mikhail Gudim via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 5 07:06:12 PDT 2023


mgudim wrote:

> I'm okay with this, but please keep this comment in mind:
> 
> https://github.com/llvm/llvm-project/blob/5c4d35d8cfd00885f98b5a863612a5194d235a10/llvm/include/llvm/Analysis/ValueTracking.h#L903-L904
> 
> If computeConstantRange() gets expanded substantially beyond this (e.g. if we did recursive binop calculations, which we currently intentionally don't do), then we'll have to re-evaluate how and where this function gets used. Being "essentially free" is part of its current feature set.

Right, maybe I can disable this by default and introduce a flag to allow expensive checks? Actually, `MaxAnalysisRecursionDepth` is 6  - is it expensive?

BTW, right now there is no way to change `MaxAnalysisRecursionDepth` by cli option. Would we like to be able to?

I have a couple more patches where I make recursive calls in `ValueTracking.cpp`, so now is a good time to figure out what is the best approach to this. 

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


More information about the llvm-commits mailing list