[llvm] X86: Remove LowerToHorizontalOp and modified test case (PR #148477)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 18 20:47:17 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp,h -- llvm/include/llvm/CodeGen/SelectionDAGISelMatchers.h llvm/include/llvm/CodeGen/SDPatternMatch.h llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp llvm/lib/Target/X86/X86ISelLowering.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/include/llvm/CodeGen/SelectionDAGISelMatchers.h b/llvm/include/llvm/CodeGen/SelectionDAGISelMatchers.h
index 926aca0be..46a390d74 100644
--- a/llvm/include/llvm/CodeGen/SelectionDAGISelMatchers.h
+++ b/llvm/include/llvm/CodeGen/SelectionDAGISelMatchers.h
@@ -10,20 +10,16 @@ struct SelectCC_match {
   const FTy &F;
   const CCTy &CC;
 
-  SelectCC_match(const LTy &l, const RTy &r,
-                 const TTy &t, const FTy &f,
+  SelectCC_match(const LTy &l, const RTy &r, const TTy &t, const FTy &f,
                  const CCTy &cc)
       : L(l), R(r), T(t), F(f), CC(cc) {}
 
-  template <typename OpTy>
-  bool match(OpTy V) const {
+  template <typename OpTy> bool match(OpTy V) const {
     if (V.getOpcode() != ISD::SELECT_CC)
       return false;
 
-    return L.match(V.getOperand(0)) &&
-           R.match(V.getOperand(1)) &&
-           T.match(V.getOperand(2)) &&
-           F.match(V.getOperand(3)) &&
+    return L.match(V.getOperand(0)) && R.match(V.getOperand(1)) &&
+           T.match(V.getOperand(2)) && F.match(V.getOperand(3)) &&
            CC.match(cast<CondCodeSDNode>(V.getOperand(4))->get());
   }
 };
@@ -31,23 +27,17 @@ struct SelectCC_match {
 // 2. 定義 m_SelectCC
 template <typename LTy, typename RTy, typename TTy, typename FTy, typename CCTy>
 inline SelectCC_match<LTy, RTy, TTy, FTy, CCTy>
-m_SelectCC(const LTy &L, const RTy &R,
-           const TTy &T, const FTy &F,
+m_SelectCC(const LTy &L, const RTy &R, const TTy &T, const FTy &F,
            const CCTy &CC) {
   return SelectCC_match<LTy, RTy, TTy, FTy, CCTy>(L, R, T, F, CC);
 }
 
 // 3. 定義 m_SelectCCLike
 template <typename LTy, typename RTy, typename TTy, typename FTy, typename CCTy>
-inline auto m_SelectCCLike(const LTy &L, const RTy &R,
-                           const TTy &T, const FTy &F,
-                           const CCTy &CC) {
-  return m_AnyOf(
-    m_Select(m_SetCC(L, R, CC), T, F),
-    m_SelectCC(L, R, T, F, CC)
-  );
+inline auto m_SelectCCLike(const LTy &L, const RTy &R, const TTy &T,
+                           const FTy &F, const CCTy &CC) {
+  return m_AnyOf(m_Select(m_SetCC(L, R, CC), T, F), m_SelectCC(L, R, T, F, CC));
 }
 
 } // namespace SDPatternMatch
 } // namespace llvm
-
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 9a83847bb..70d23de34 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -264,7 +264,7 @@ namespace {
             VT.getSizeInBits().getKnownMinValue() >= MaximumLegalStoreInBits)
           MaximumLegalStoreInBits = VT.getSizeInBits().getKnownMinValue();
     }
-    
+
     template <typename LTy, typename RTy, typename TTy, typename FTy,
               typename CCTy>
     struct SelectCC_match {
@@ -280,9 +280,10 @@ namespace {
 
       template <typename MatchContext>
       bool match(const MatchContext &Ctx, SDValue V) const {
-        return V.getOpcode() == ISD::SELECT_CC && L.match(Ctx, V.getOperand(0)) &&
-               R.match(Ctx, V.getOperand(1)) && T.match(Ctx, V.getOperand(2)) &&
-               F.match(Ctx, V.getOperand(3)) && CC.match(Ctx, V.getOperand(4));
+        return V.getOpcode() == ISD::SELECT_CC &&
+               L.match(Ctx, V.getOperand(0)) && R.match(Ctx, V.getOperand(1)) &&
+               T.match(Ctx, V.getOperand(2)) && F.match(Ctx, V.getOperand(3)) &&
+               CC.match(Ctx, V.getOperand(4));
       }
     };
 
@@ -16885,12 +16886,13 @@ SDValue DAGCombiner::visitFREEZE(SDNode *N) {
 
 /// We know that BV is a build_vector node with Constant, ConstantFP or Undef
 /// operands. DstEltVT indicates the destination element value type.
-SDValue DAGCombiner::
-ConstantFoldBITCASTofBUILD_VECTOR(SDNode *BV, EVT DstEltVT) {
+SDValue DAGCombiner::ConstantFoldBITCASTofBUILD_VECTOR(SDNode *BV,
+                                                       EVT DstEltVT) {
   EVT SrcEltVT = BV->getValueType(0).getVectorElementType();
 
   // If this is already the right type, we're done.
-  if (SrcEltVT == DstEltVT) return SDValue(BV, 0);
+  if (SrcEltVT == DstEltVT)
+    return SDValue(BV, 0);
 
   unsigned SrcBitSize = SrcEltVT.getSizeInBits();
   unsigned DstBitSize = DstEltVT.getSizeInBits();

``````````

</details>


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


More information about the llvm-commits mailing list