[llvm] [ValueTracking] Extend LHS/RHS with matching operand to work without constants. (PR #85557)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 17 08:58:11 PDT 2024
goldsteinn wrote:
> I am not sure whether it is suitable to use `computeConstantRange` in `isImpliedCond`.
>
> See also nikic's comment: [#69840 (comment)](https://github.com/llvm/llvm-project/pull/69840#issuecomment-1868009304)
So originally my goal was just to handle cases like `X u> Y` implies `X != 0`.
My first attempt was a bespoke set of switching statements, but pretty quickly saw that just changing to CR would be an easier and less bugprone way to impl that. At that point I wasn't using `computeConstantRange`, just `getFull` if the argument wasn't an APInt.
Then figured, if there is no big compile time impact just using `computeConstantRange`, that just purely more information, so here we are.
My point is I think basically each step seems like a reasonable improvement on the alternative. If the compile time impact is a proper concern, think it may make sense to constrain `computeConstantRange` (maybe pass MaxDepth - 1), but other than that, not sure what the rationale against is.
https://github.com/llvm/llvm-project/pull/85557
More information about the llvm-commits
mailing list