[PATCH] D92726: Teach isKnownNonEqual how to recurse through invertable multiplies
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 7 13:11:31 PST 2020
nikic added inline comments.
================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:2540
+ if (!cast<BinaryOperator>(O1)->hasNoUnsignedWrap() ||
+ !cast<BinaryOperator>(O2)->hasNoUnsignedWrap())
+ break;
----------------
For completely sake, I think this should handle the nsw case as well.
================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:2543
+
+ // Assume operand order has been canonicalized
+ if (O1->getOperand(0) == O2->getOperand(0) &&
----------------
With canonicalized operands, the constant can only be on the RHS.
================
Comment at: llvm/test/Analysis/ValueTracking/known-non-equal.ll:169
+ %A.op = mul i8 0, %A
+ %B.op = mul i8 0, %B
+
----------------
Add `nuw` to these to make it eligible in the first place?
================
Comment at: llvm/test/Analysis/ValueTracking/known-non-equal.ll:173
+ ret i1 %cmp
+}
+
----------------
We should also have a negative test with `nuw` but non-constant (and thus not known non zero) common operand.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92726/new/
https://reviews.llvm.org/D92726
More information about the llvm-commits
mailing list