[llvm] [SystemZ] Fix type mismatch in the creation of VSUM nodes in lowerCTPOP. (PR #228667)

via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 2 23:38:32 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-systemz

Author: Craig Topper (topperc)

<details>
<summary>Changes</summary>

Both operands of VSUM should have the same type. Bitcast the v16i8 zero vector to v4i32 to make the types match.

Found while adding SDTCisSameAs to SDNodeInfo::verifyNode.

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


1 Files Affected:

- (modified) llvm/lib/Target/SystemZ/SystemZISelLowering.cpp (+1) 


``````````diff
diff --git a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
index a6cc3e94b7e7d..c05fae6146e9c 100644
--- a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
@@ -5108,6 +5108,7 @@ SDValue SystemZTargetLowering::lowerCTPOP(SDValue Op,
       SDValue Tmp = DAG.getSplatBuildVector(MVT::v16i8, DL,
                                             DAG.getConstant(0, DL, MVT::i32));
       Op = DAG.getNode(SystemZISD::VSUM, DL, MVT::v4i32, Op, Tmp);
+      Tmp = DAG.getNode(ISD::BITCAST, DL, MVT::v4i32, Tmp);
       Op = DAG.getNode(SystemZISD::VSUM, DL, VT, Op, Tmp);
       break;
     }

``````````

</details>


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


More information about the llvm-commits mailing list