[PATCH] D75840: [ExpandMemCmp] Improve non-equality comparisons with zero.
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 12 06:29:59 PDT 2020
spatel added a comment.
Side note: I was wondering what these patterns look like in DAG/IR, and why we're missing them, so:
D75961 <https://reviews.llvm.org/D75961>
We could argue that it's worth solving these more generally in DAGCombiner, but if we can produce the optimal code here without too much effort, that's good too.
================
Comment at: llvm/lib/CodeGen/ExpandMemCmp.cpp:397
+ Cmp = Builder.CreateICmp(
+ ICmpInst::getUnsignedPredicate(ZeroCmpKind), Loads.Lhs, Loads.Rhs);
+
----------------
That looks like the right fix, but it could use a comment so we'll remember why. Something like this:
// The result of memcmp is a signed value, so the relational
// compare kind predicate is always signed. But the byte
// comparison used within memcmp is always unsigned.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75840/new/
https://reviews.llvm.org/D75840
More information about the llvm-commits
mailing list