[llvm] [InstCombine] Remove over-generalization from computeKnownBitsFromCmp() (PR #72637)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 20 09:39:21 PST 2023
goldsteinn 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.
I see. That seems like a reasonable motivation.
Although I'd think a few simple cases (like `X == Y`) would provide enough value to justify the cost.
https://github.com/llvm/llvm-project/pull/72637
More information about the llvm-commits
mailing list