forked from OSchip/llvm-project
[RISCV] Prevent bad legalizer behavior when bitcasting fixed vectors to i64 on RV32 with Zve32.
Similar to D113219, we need to make sure we don't create a vXi64 vector when it isn't legal. This fixes an error found by an expensive checks build.
This commit is contained in:
parent
18d883cc0a
commit
9ee5cec688
|
@ -5726,10 +5726,12 @@ void RISCVTargetLowering::ReplaceNodeResults(SDNode *N,
|
|||
// scalar types in order to improve codegen. Bitcast the vector to a
|
||||
// one-element vector type whose element type is the same as the result
|
||||
// type, and extract the first element.
|
||||
LLVMContext &Context = *DAG.getContext();
|
||||
SDValue BVec = DAG.getBitcast(EVT::getVectorVT(Context, VT, 1), Op0);
|
||||
Results.push_back(DAG.getNode(ISD::EXTRACT_VECTOR_ELT, DL, VT, BVec,
|
||||
DAG.getConstant(0, DL, XLenVT)));
|
||||
EVT BVT = EVT::getVectorVT(*DAG.getContext(), VT, 1);
|
||||
if (isTypeLegal(BVT)) {
|
||||
SDValue BVec = DAG.getBitcast(BVT, Op0);
|
||||
Results.push_back(DAG.getNode(ISD::EXTRACT_VECTOR_ELT, DL, VT, BVec,
|
||||
DAG.getConstant(0, DL, XLenVT)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue