[llvm] [LoongArch] Fix broadcast load with extension. (PR #155960)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 30 07:36:34 PDT 2025
================
@@ -2471,8 +2471,10 @@ static SDValue lowerBUILD_VECTORAsBroadCastLoad(BuildVectorSDNode *BVOp,
if (!IdentitySrc || !BVOp->isOnlyUserOf(IdentitySrc.getNode()))
return SDValue();
- if (IsIdeneity) {
- auto *LN = cast<LoadSDNode>(IdentitySrc);
+ auto *LN = cast<LoadSDNode>(IdentitySrc);
+ auto ExtType = LN->getExtensionType();
+
+ if (IsIdeneity && (ExtType == ISD::EXTLOAD || ExtType == ISD::NON_EXTLOAD)) {
----------------
heiher wrote:
I'm a bit concerned about assuming that `ISD::EXTLOAD` always implies `MemoryVT` and `VectorElementVT` are the same size. I can’t come up with a concrete counterexample right now, but I’m not entirely confident this will always hold true going forward. My preference would be to explicitly check that the two types have equal size, this way we can be sure the load width matches the vector element width, and it lines up cleanly with `vldrepl`.
https://github.com/llvm/llvm-project/pull/155960
More information about the llvm-commits
mailing list