[llvm] 5d31569 - [RISCV] Add missing bitcasts to the results of lowerINSERT_SUBVECTOR and lowerEXTRACT_SUBVECTOR when handling mask vectors.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 19 10:55:01 PDT 2021
Author: Craig Topper
Date: 2021-03-19T10:54:33-07:00
New Revision: 5d315691c42b57d1858d0f8dc486708bf839cdb3
URL: https://github.com/llvm/llvm-project/commit/5d315691c42b57d1858d0f8dc486708bf839cdb3
DIFF: https://github.com/llvm/llvm-project/commit/5d315691c42b57d1858d0f8dc486708bf839cdb3.diff
LOG: [RISCV] Add missing bitcasts to the results of lowerINSERT_SUBVECTOR and lowerEXTRACT_SUBVECTOR when handling mask vectors.
Found by adding asserts to LegalizeDAG to catch incorrect result
types being returned.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D98964
Added:
Modified:
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 6dfc2d46afe1..3bde5158c9b1 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -2876,9 +2876,9 @@ SDValue RISCVTargetLowering::lowerINSERT_SUBVECTOR(SDValue Op,
SDValue SlideupAmt = DAG.getConstant(OrigIdx, DL, XLenVT);
SDValue Slideup = DAG.getNode(RISCVISD::VSLIDEUP_VL, DL, ContainerVT, Vec,
SubVec, SlideupAmt, Mask, VL);
- if (!VecVT.isFixedLengthVector())
- return Slideup;
- return convertFromScalableVector(VecVT, Slideup, DAG, Subtarget);
+ if (VecVT.isFixedLengthVector())
+ Slideup = convertFromScalableVector(VecVT, Slideup, DAG, Subtarget);
+ return DAG.getBitcast(Op.getValueType(), Slideup);
}
unsigned SubRegIdx, RemIdx;
@@ -3025,8 +3025,9 @@ SDValue RISCVTargetLowering::lowerEXTRACT_SUBVECTOR(SDValue Op,
DAG.getNode(RISCVISD::VSLIDEDOWN_VL, DL, ContainerVT,
DAG.getUNDEF(ContainerVT), Vec, SlidedownAmt, Mask, VL);
// Now we can use a cast-like subvector extract to get the result.
- return DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, SubVecVT, Slidedown,
- DAG.getConstant(0, DL, XLenVT));
+ Slidedown = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, SubVecVT, Slidedown,
+ DAG.getConstant(0, DL, XLenVT));
+ return DAG.getBitcast(Op.getValueType(), Slidedown);
}
unsigned SubRegIdx, RemIdx;
More information about the llvm-commits
mailing list