Skip to content

Commit d6fc6fc

Browse files
arsenmcpiaseque
authored andcommitted
DAG: Fix assert when legalizing v3f16 ldexp (llvm#97098)
For the v3f16.v3i32 case, the v3f16 would request widening to v4f16, but the v3i32 does not require widening to be a legal type, so GetWidenedVector would fail. We need to widen the exponent vector to the same element count as the result. Fixes: SWDEV-470951
1 parent b50f42e commit d6fc6fc

File tree

2 files changed

+508
-1
lines changed

2 files changed

+508
-1
lines changed

llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5231,7 +5231,13 @@ SDValue DAGTypeLegalizer::WidenVecRes_ExpOp(SDNode *N) {
52315231
EVT WidenVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0));
52325232
SDValue InOp = GetWidenedVector(N->getOperand(0));
52335233
SDValue RHS = N->getOperand(1);
5234-
SDValue ExpOp = RHS.getValueType().isVector() ? GetWidenedVector(RHS) : RHS;
5234+
EVT ExpVT = RHS.getValueType();
5235+
SDValue ExpOp = RHS;
5236+
if (ExpVT.isVector()) {
5237+
EVT WideExpVT =
5238+
WidenVT.changeVectorElementType(ExpVT.getVectorElementType());
5239+
ExpOp = ModifyToType(RHS, WideExpVT);
5240+
}
52355241

52365242
return DAG.getNode(N->getOpcode(), SDLoc(N), WidenVT, InOp, ExpOp);
52375243
}

0 commit comments

Comments
 (0)