[llvm] [X86] Sink NOT to be fold into ANDN (PR #172329)

Piotr Fusik via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 17 03:38:03 PST 2025


================
@@ -7198,6 +7198,28 @@ bool X86TTIImpl::isProfitableToSinkOperands(Instruction *I,
                                             SmallVectorImpl<Use *> &Ops) const {
   using namespace llvm::PatternMatch;
 
+  if (I->getOpcode() == Instruction::And &&
+      (ST->hasBMI() || (I->getType()->isVectorTy() && ST->hasSSE2()))) {
+    for (auto &Op : I->operands()) {
----------------
pfusik wrote:

`m_c_And()` doesn't tell us which of the two operands is a `not` and we need to return the `Use` of `not` in `Ops`.

https://github.com/llvm/llvm-project/pull/172329


More information about the llvm-commits mailing list