[llvm] [CodeGen] Construct SmallVector with ArrayRef (NFC) (PR #143391)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 9 08:23:56 PDT 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/143391

None

>From d94efe11db798bcf25c9ea0bf81b1d2499dd0979 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Mon, 9 Jun 2025 07:35:26 -0700
Subject: [PATCH] [CodeGen] Construct SmallVector with ArrayRef (NFC)

---
 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index 5fe15e44c95bb..f5f4d71236fee 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -3562,9 +3562,7 @@ bool SelectionDAGLegalize::ExpandNode(SDNode *Node) {
     unsigned Factor = Node->getNumOperands();
     if (Factor <= 2 || !isPowerOf2_32(Factor))
       break;
-    SmallVector<SDValue, 8> Ops;
-    for (SDValue Op : Node->ops())
-      Ops.push_back(Op);
+    SmallVector<SDValue, 8> Ops(Node->ops());
     EVT VecVT = Node->getValueType(0);
     SmallVector<EVT> HalfVTs(Factor / 2, VecVT);
     // Deinterleave at Factor/2 so each result contains two factors interleaved:



More information about the llvm-commits mailing list