[PATCH] D67849: [InstCombine] (a+b) < a && (a+b) != 0 -> (0-b) < a iff a/b != 0 (PR43259)

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 24 05:54:34 PDT 2019


lebedev.ri added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:1064
 
+  auto IsKnownNonZero = [&](Value *V) {
+    return isKnownNonZero(V, Q.DL, /*Depth=*/0, Q.AC, Q.CxtI, Q.DT);
----------------
xbolva00 wrote:
> lebedev.ri wrote:
> > xbolva00 wrote:
> > > I think we dont need this lambda.. Just inline it.
> > I don't see why spelling all that each time is better.
> So just add a new overload which takes
> 
> isKnownNonZero(V, Q)?
ValueTracking.h (that defines internal `Query` struct) does not
include InstructionSimplify (that defines `SimplifyQuery` struct).
Going in either direction does not seem optimal, and seems out of the scope of the patch.

This isn't C, and in C++ i suppose using helpers if they improve code readability is not frowned upon..


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67849





More information about the llvm-commits mailing list