forked from OSchip/llvm-project
[LegalizeTypes] Further limit expansion of CTTZ during type promotion.
Don't expand CTTZ if CTPOP or CTLZ is supported on the promoted type. We have special handling for CTTZ expansion to use those ops with a small conversion. The setup for that doesn't generate extra code or large constants so we don't gain anything from expanding early and we make CTTZ_ZERO_UNDEF codegen worse. Follow up from post commit feedback on D112268. We don't seem to have any in tree tests that care about this.
This commit is contained in:
parent
951b107eed
commit
d78fdf111d
|
@ -622,10 +622,13 @@ SDValue DAGTypeLegalizer::PromoteIntRes_CTTZ(SDNode *N) {
|
|||
|
||||
// If the larger CTTZ isn't supported by the target, try to expand now.
|
||||
// If we expand later we'll end up with more operations since we lost the
|
||||
// original type.
|
||||
// original type. Don't expand if we can use CTPOP or CTLZ expansion on the
|
||||
// larger type.
|
||||
if (!OVT.isVector() && TLI.isTypeLegal(NVT) &&
|
||||
!TLI.isOperationLegalOrCustomOrPromote(ISD::CTTZ, NVT) &&
|
||||
!TLI.isOperationLegalOrCustomOrPromote(ISD::CTTZ_ZERO_UNDEF, NVT)) {
|
||||
!TLI.isOperationLegalOrCustomOrPromote(ISD::CTTZ_ZERO_UNDEF, NVT) &&
|
||||
!TLI.isOperationLegal(ISD::CTPOP, NVT) &&
|
||||
!TLI.isOperationLegal(ISD::CTLZ, NVT)) {
|
||||
if (SDValue Result = TLI.expandCTTZ(N, DAG)) {
|
||||
Result = DAG.getNode(ISD::ANY_EXTEND, dl, NVT, Result);
|
||||
return Result;
|
||||
|
|
Loading…
Reference in New Issue