[PATCH] D141482: [LVI][CVP] Make use of condition known at use

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 11 10:27:17 PST 2023


spatel added reviewers: lebedev.ri, fhahn.
spatel added a comment.

Seems like a nice improvement to me, but adding some more potential reviewers in case there are other opinions.

If the intent is to eventually call from other places, the most basic case would be something like this?

  define i16 @sel_true_cond(i16 %x) {
    %cmp = icmp eq i16 %x, 10
    %sel = select i1 %cmp, i16 %x, i16 42   ; can replace %x with 10
    ret i16 %sel
  }

If so, might want to adjust the test names because patterns with an overflow intrinsic are not the minimal case.



================
Comment at: llvm/lib/Analysis/LazyValueInfo.cpp:1662
+  const Use *CurrU = &U;
+  for (int I = 0; I < 2; ++I) {
+    std::optional<ValueLatticeElement> CondVal;
----------------
The meaning of this loop wasn't clear to me on first reading. 

If the intent is to experiment with optimization power vs. compile-time, make this a `cl::opt` or give the limit a name like `static const unsigned MaxUserRangesToIntersect`?


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

https://reviews.llvm.org/D141482



More information about the llvm-commits mailing list