[llvm] [LLVM][CodeGen] Remove failure cases when widening EXTRACT/INSERT_SUBVECTOR. (PR #162308)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 25 09:06:06 PST 2025


================
@@ -6201,8 +6201,33 @@ SDValue DAGTypeLegalizer::WidenVecRes_EXTRACT_SUBVECTOR(SDNode *N) {
       return DAG.getNode(ISD::CONCAT_VECTORS, dl, WidenVT, Parts);
     }
 
-    report_fatal_error("Don't know how to widen the result of "
-                       "EXTRACT_SUBVECTOR for scalable vectors");
+    // Fallback to extracting through memory.
+
+    Align Alignment = DAG.getReducedAlign(InVT, /*UseABI=*/false);
+    SDValue StackPtr = DAG.CreateStackTemporary(InVT.getStoreSize(), Alignment);
+    auto &MF = DAG.getMachineFunction();
+    auto FrameIndex = cast<FrameIndexSDNode>(StackPtr.getNode())->getIndex();
----------------
arsenm wrote:

```suggestion
    MachineFunction &MF = DAG.getMachineFunction();
    int FrameIndex = cast<FrameIndexSDNode>(StackPtr.getNode())->getIndex();
```

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


More information about the llvm-commits mailing list