[llvm] [instcombine] Delete dead transform for rev(binop splat, rev(x)) (PR #143967)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 12 13:45:41 PDT 2025


https://github.com/preames created https://github.com/llvm/llvm-project/pull/143967

We canonicalize splats to RHS, so this transform should be dead code.

>From 95d8a50d20ca270e65bb1641b03b6e44b87bcc56 Mon Sep 17 00:00:00 2001
From: Philip Reames <preames at rivosinc.com>
Date: Thu, 12 Jun 2025 13:44:17 -0700
Subject: [PATCH] [instcombine] Delete dead transform for rev(binop splat,
 rev(x))

We canonicalize splats to RHS, so this transform should be dead code.
---
 llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index c169ab25b2106..d5738520715b0 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -3565,12 +3565,6 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
                                              OldBinOp, OldBinOp->getName(),
                                              II->getIterator()));
       }
-      // rev(binop BO0Splat, rev(Y)) --> binop BO0Splat, Y
-      if (match(BO1, m_VecReverse(m_Value(Y))) && isSplatValue(BO0))
-        return replaceInstUsesWith(CI,
-                                   BinaryOperator::CreateWithCopiedFlags(
-                                       OldBinOp->getOpcode(), BO0, Y, OldBinOp,
-                                       OldBinOp->getName(), II->getIterator()));
     }
     // rev(unop rev(X)) --> unop X
     if (match(Vec, m_OneUse(m_UnOp(m_VecReverse(m_Value(X)))))) {



More information about the llvm-commits mailing list