Skip to content

Conversation

RKSimon
Copy link
Collaborator

@RKSimon RKSimon commented Sep 17, 2025

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

…gain. NFC.

We have assertions above confirming VT == N1.getValueType() for INSERT_VECTOR_ELT nodes.
@llvmbot llvmbot added the llvm:SelectionDAG SelectionDAGISel as well label Sep 17, 2025
@RKSimon RKSimon enabled auto-merge (squash) September 17, 2025 15:20
@llvmbot
Copy link
Member

llvmbot commented Sep 17, 2025

@llvm/pr-subscribers-llvm-selectiondag

Author: Simon Pilgrim (RKSimon)

Changes

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


Full diff: https://github.com/llvm/llvm-project/pull/159381.diff

1 Files Affected:

  • (modified) llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (+2-2)
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.

@RKSimon RKSimon merged commit 57d67be into llvm:main Sep 17, 2025
11 checks passed
@RKSimon RKSimon deleted the dag-getnode-insert_vector_elt-type branch September 17, 2025 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
llvm:SelectionDAG SelectionDAGISel as well
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants