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

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 2 09:05:42 PDT 2022


spatel 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,
----------------
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?


================
Comment at: llvm/test/Transforms/CorrelatedValuePropagation/mul.ll:215-216
 entry:
   %c = add nuw nsw i8 %b, -3
   %mul = mul nsw i8 %c, 4
   %cmp = icmp slt i8 %c, %mul
----------------
"add nuw" is all that is needed to fold this and the next test. Do those simpler examples work, or should there be a TODO?


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

https://reviews.llvm.org/D137253



More information about the llvm-commits mailing list