[llvm] [DAG] getNode() - reuse result type instead of calling getValueType again. NFC. (PR #159381)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 17 08:20:07 PDT 2025


https://github.com/RKSimon created https://github.com/llvm/llvm-project/pull/159381

We have assertions above confirming VT == N1.getValueType() for INSERT_VECTOR_ELT nodes.

>From d43dad3a0962ae73dc12c42e340d77d220a1876b Mon Sep 17 00:00:00 2001
From: Simon Pilgrim <llvm-dev at redking.me.uk>
Date: Wed, 17 Sep 2025 14:54:38 +0100
Subject: [PATCH] [DAG] getNode() - reuse result type instead of calling
 getValueType again. NFC.

We have assertions above confirming VT == N1.getValueType() for INSERT_VECTOR_ELT nodes.
---
 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 029eb025ff1de..5b2c09ffecbe2 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -8247,8 +8247,8 @@ SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
     // INSERT_VECTOR_ELT into out-of-bounds element is an UNDEF, except
     // for scalable vectors where we will generate appropriate code to
     // deal with out-of-bounds cases correctly.
-    if (N3C && N1.getValueType().isFixedLengthVector() &&
-        N3C->getZExtValue() >= N1.getValueType().getVectorNumElements())
+    if (N3C && VT.isFixedLengthVector() &&
+        N3C->getZExtValue() >= VT.getVectorNumElements())
       return getUNDEF(VT);
 
     // Undefined index can be assumed out-of-bounds, so that's UNDEF too.



More information about the llvm-commits mailing list