[llvm] [SelectionDAG] Freeze dynamic vector indices lowered through the stack (PR #225031)

Hongyu Chen via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 21 04:32:13 PDT 2026


================
@@ -25436,6 +25358,9 @@ SDValue DAGCombiner::visitINSERT_VECTOR_ELT(SDNode *N) {
           if (!IsByteSized && Elmnt.getValueType().bitsLT(EltVT))
             Elmnt = DAG.getNode(ISD::ANY_EXTEND, DL, EltVT, Elmnt);
 
+          // Freeze the index, as clamping a poison index would be meaningless.
----------------
XChy wrote:

I did not find any context about "clamp" here. IIUC, do you mean the clamping in `getVectorElementPointer` ?
A better explanation may be that a vector operation with poison index produces poison, but the load/store through poison pointer causes immediate UB, which is more undefined?

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


More information about the llvm-commits mailing list