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

Piotr Fusik via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 22 06:58:40 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:

`for (auto &Op : I->operands())` is used later in this function, as well as on [AMDGPU](https://github.com/llvm/llvm-project/blob/2c841b74bd5306054fff2f6778237708f7d30884/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp#L1374) and [RISC-V](https://github.com/llvm/llvm-project/blob/2c841b74bd5306054fff2f6778237708f7d30884/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp#L3362).

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


More information about the llvm-commits mailing list