[PATCH] D100408: [ValueTracking][InstSimplify] improve efficiency for detecting non-zero value

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 14 05:48:23 PDT 2021


spatel marked an inline comment as done.
spatel added inline comments.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:2232
+      if (!StartC->isNullValue() && !StepC->isNullValue())
+        return true;
+    }
----------------
nikic wrote:
> I'd directly `return !StartC->isNullValue() && !StepC->isNullValue();` here and below.
> 
> As a side note, the requirement that `StepC` is non-zero is unnecessary here -- which also means that we don't need it to be a constant. But that's independent of your patch.
Good point - this patch should be clearer if we hoist the StartC null check:
49193653974a

I'll add a TODO about the StepC requirement.


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

https://reviews.llvm.org/D100408



More information about the llvm-commits mailing list