[llvm] [ExpandMemCmp] Recognize canonical form of (icmp sle/sge X, 0) in getMemCmpOneBlock. (PR #121540)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 3 01:30:22 PST 2025
================
@@ -680,9 +680,19 @@ Value *MemCmpExpansion::getMemCmpOneBlock() {
Shift == (CI->getType()->getIntegerBitWidth() - 1)) {
Pred = ICmpInst::ICMP_SLT;
NeedsZExt = true;
+ } else if (match(UI, m_ICmp(Pred, m_Specific(CI), m_Zero()))) {
+ // Compare with 0. Pred is already set.
+ } else if (match(UI, m_ICmp(Pred, m_Specific(CI), m_AllOnes())) &&
+ Pred == ICmpInst::ICMP_SGT) {
----------------
nikic wrote:
Use m_SpecificICmp instead.
https://github.com/llvm/llvm-project/pull/121540
More information about the llvm-commits
mailing list