[PATCH] D151911: [LVI] Handle icmp of ashr.

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 13 01:09:25 PDT 2023


nikic added a comment.

In D151911#4416351 <https://reviews.llvm.org/D151911#4416351>, @aemerson wrote:

> The original proof from 7ac2db6a489f3f8e588589a69164882df7973d34 <https://github.com/llvm/llvm-project/commit/7ac2db6a489f3f8e588589a69164882df7973d34> isn't alive (ha) anymore, so I re-created it: https://alive2.llvm.org/ce/z/SfpsvX

Thanks! However, that proof has a bunch of preconditions -- don't we need to check them here as well?



================
Comment at: llvm/lib/Analysis/LazyValueInfo.cpp:1155
+  const APInt *ShAmtC, *RHSC;
+  if (CmpInst::isSigned(EdgePred) &&
+      match(LHS, m_AShr(m_Specific(Val), m_APInt(ShAmtC))) &&
----------------
Don't we have to adjust the range based on the predicate? E.g. the result for `sgt` and `sle` would be inverts of each other, while this returns the same range for both.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151911



More information about the llvm-commits mailing list