[llvm] [GlobalISel] Drop redundant scalable-dest check in G_EXTRACT_SUBVECTOR lowering (NFC) (PR #221934)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 8 02:23:55 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-globalisel

Author: Szymon Piotr Milczek (smilczek)

<details>
<summary>Changes</summary>

The scalarizing lowering of G_EXTRACT_SUBVECTOR bails out for both a
scalable source and a scalable destination.
According to llvm/docs/GlobalISel/GenericOpcode.md, G_EXTRACT_SUBVECTOR
only supports extracting a fixed vector from a scalable vector, never a
scalable vector from a fixed one.
This means that a fixed source implies a fixed destination, making the
DstTy.isScalable() check redundant.

Remove it. NFC.

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


1 Files Affected:

- (modified) llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp (+1-1) 


``````````diff
diff --git a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
index b73d363f22665..0257119da0a6e 100644
--- a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
@@ -5008,7 +5008,7 @@ LegalizerHelper::lower(MachineInstr &MI, unsigned TypeIdx, LLT LowerHintTy) {
     LLT SrcTy = MRI.getType(SrcReg);
     LLT DstTy = MRI.getType(DstReg);
 
-    if (SrcTy.isScalable() || DstTy.isScalable())
+    if (SrcTy.isScalable())
       return UnableToLegalize;
 
     if (SrcTy.getScalarType() != DstTy.getScalarType())

``````````

</details>


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


More information about the llvm-commits mailing list