[llvm] [InstCombine] Remove over-generalization from computeKnownBitsFromCmp() (PR #72637)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 20 09:30:31 PST 2023


nikic wrote:

> Some of the simplifications here make sense independent of general -> constant simplification. But for the general -> constant simplification, imo it makes more sense to add coverage as opposed to just dropping the code. Particularly a few cases like `X == Y`, think its simple enough to support non-constant `Y` and can imagine practical value from that type of analysis.

The context of this change is that I want to handle dominating conditions in computeKnownBits(), and would like it to use the same logic as computeKnownBitsFromCmp() currently used for assumes. Currently, we don't really feel the compile-time impact of this function, because assumes are very rare when compiling C/C++. When handling dominating conditions, the support for non-constants adds quite a lot of compile-time overhead without any significant effect on results (I checked).

I could use completely independent logic for assumes and dominating conditions, but I don't particularly want to.

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


More information about the llvm-commits mailing list