[PATCH] D69686: [LVI][CVP] Use block value when simplifying icmps

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 27 07:24:19 PDT 2020


fhahn added a comment.

LGTM as long as this is not too expensive in terms of compile-time, thanks!

As mentioned in the comments and description, this catches cases we cannot really catch in (IP)SCCP or other places at the moment. In particular, the way conditional information is handled in IPSCCP does not allow this kind of simplifications without major changes.



================
Comment at: llvm/lib/Analysis/LazyValueInfo.cpp:1761
+  ValueLatticeElement Result = UseBlockValue
+      ? getImpl(PImpl, AC, M).getValueInBlock(V, CxtI->getParent(), CxtI)
+      : getImpl(PImpl, AC, M).getValueAt(V, CxtI);
----------------
Currently the comment for `getValueInBlock` says it returns the value at the end of the block. IIUC this only refers to the fact that all assumes in the block are used. But if `CxtI` is passed, only assumes dominating `CxtI` are passed, so effectively we get the value at `CxtI`? Might be good to clarify this in the docs.


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

https://reviews.llvm.org/D69686



More information about the llvm-commits mailing list