Skip to content

Commit 18d3a5d

Browse files
authored
[LegalizeVectorTypes] When widening don't check for libcalls if promoted (#111297)
When widening some FP ops, LegalizeVectorTypes will check to see if the widened op may be scalarized and then turned into a bunch of libcalls, and if so unroll early to avoid unnecessary libcalls of the padded undef elements. It checks if the widened op is legal or custom to see if it will be scalarized, but promoted ops will also avoid scalarization. This relaxes the check to account for this which fixes some illegal vector types on RISC-V from being scalarized when they could be widened.
1 parent 5a9e93f commit 18d3a5d

File tree

2 files changed

+95
-1578
lines changed

2 files changed

+95
-1578
lines changed

llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4441,7 +4441,7 @@ void DAGTypeLegalizer::WidenVectorResult(SDNode *N, unsigned ResNo) {
44414441
// libcalls on the undef elements.
44424442
EVT VT = N->getValueType(0);
44434443
EVT WideVecVT = TLI.getTypeToTransformTo(*DAG.getContext(), VT);
4444-
if (!TLI.isOperationLegalOrCustom(N->getOpcode(), WideVecVT) &&
4444+
if (!TLI.isOperationLegalOrCustomOrPromote(N->getOpcode(), WideVecVT) &&
44454445
TLI.isOperationExpand(N->getOpcode(), VT.getScalarType())) {
44464446
Res = DAG.UnrollVectorOp(N, WideVecVT.getVectorNumElements());
44474447
return true;

0 commit comments

Comments
 (0)