[PATCH] D125551: [ValueTracking] Handle and/or on RHS of isImpliedCondition()

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 16 05:38:47 PDT 2022


spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:6675-6679
+    if (!isImpliedCondition(LHS, RHS1, DL, LHSIsTrue, Depth + 1)
+            .getValueOr(true) ||
+        !isImpliedCondition(LHS, RHS2, DL, LHSIsTrue, Depth + 1)
+            .getValueOr(true))
+      return false;
----------------
I had to step through this to convince myself that the logic was correct.

That is probably the shortest way to write it, but something like this might be easier to read?
    if (auto ImpR1 = isImpliedCondition(LHS, RHS1, DL, LHSIsTrue, Depth + 1))
      if (*ImpR1 == false)
        return false;
    if (auto ImpR2 = isImpliedCondition(LHS, RHS2, DL, LHSIsTrue, Depth + 1))
      if (*ImpR2 == false)
        return false;



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

https://reviews.llvm.org/D125551



More information about the llvm-commits mailing list