[PATCH] D126171: [InstCombine] fold icmp of zext bool based on limited range

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 22 12:07:31 PDT 2022


nikic added a comment.

https://alive2.llvm.org/ce/z/2JTkdF



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:5647
+    Pred = I.getSwappedPredicate();
+  }
+
----------------
Might make sense to use m_c_ICmp instead? Something along these lines:

```
if (match(I, m_c_ICmp(Pred, m_Value(X), m_OneUse(m_ZExt(m_Value(Y))))) &&
    Y->getType()->isIntOrIntVectorTy(1) && Pred == ICmpInst::ICMP_ULT)
```

That would probably make it easier to extend this to the conjugate sext pattern: https://alive2.llvm.org/ce/z/2JTkdF


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

https://reviews.llvm.org/D126171



More information about the llvm-commits mailing list