[PATCH] D152646: [ValueTracking] More unsigned binary op implied conditions

Joshua Cao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 11 15:28:56 PDT 2023


caojoshua added a comment.

In D152646#4411887 <https://reviews.llvm.org/D152646#4411887>, @nikic wrote:

> I predicted this is going to happen in https://reviews.llvm.org/D149510#4315073, and now it is happening. You are reimplementing InstSimplify comparison folding in isTruePredicate().

I'm not aware of where in InstSimplify this is re-implementing. `simplifyICmp()` and `simplifyICmpOfBools()` both make calls out to `isTruePredicate()`. Passing in the test  examples to places like InstCombine or ConstraintElimination does not simplify. I don't believe existing logic to simplify these cases exists right now.

I believe that `isTruePredicate()` is the correct place to put this logic right now. I agree with your concerns on writing a bunch of different rules, but I don't see another way if we want to optimize these cases (maybe pick out the ones that are more useful, like subtraction).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152646/new/

https://reviews.llvm.org/D152646



More information about the llvm-commits mailing list