[PATCH] D137253: [CVP] Simplify comparisons without constant operand

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 3 02:03:46 PDT 2022


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


================
Comment at: llvm/lib/Analysis/LazyValueInfo.cpp:1874
+        getImpl(PImpl, AC, M).getValueInBlock(RHS, CxtI->getParent(), CxtI);
+    Type *Ty = Type::getInt1Ty(CxtI->getContext());
+    if (Constant *Res = L.getCompare((CmpInst::Predicate)P, Ty, R,
----------------
spatel wrote:
> Does something in the callers preclude vector icmp from reaching here? If not, should this use CmpInst::makeCmpResultType()? If yes, then can we assert that LHS/RHS are scalars?
Vector icmps can reach this function, but LVI will always produce overdefined for the operands. That said, it still makes sense to use makeCmpResultType() to make this more future proof, in case LVI gets vector support.

I've also added a vector icmp test case (which currently does not fold).


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

https://reviews.llvm.org/D137253



More information about the llvm-commits mailing list