[llvm] [DAG] Expand mask_beforefirst during promotion (PR #230163)
Paul Walker via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 9 03:58:40 PDT 2026
================
@@ -6465,6 +6465,13 @@ SDValue DAGTypeLegalizer::PromoteIntRes_GET_ACTIVE_LANE_MASK(SDNode *N) {
SDValue DAGTypeLegalizer::PromoteIntRes_MASK_BEFOREFIRST(SDNode *N) {
EVT VT = N->getValueType(0);
EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), VT);
+
+ // If the promoted MASK_BEFOREFIRST isn't supported by the target, try to
+ // expand now so the target can lower cttz_elts on the original mask type.
+ if (!TLI.isOperationLegalOrCustom(ISD::MASK_BEFOREFIRST, NVT))
+ return DAG.getNode(ISD::ANY_EXTEND, SDLoc(N), NVT,
+ TLI.expandMaskBeforeFirst(N, DAG));
----------------
paulwalker-arm wrote:
This is not correct because the mask result must match the expectations of getBooleanContents().
https://github.com/llvm/llvm-project/pull/230163
More information about the llvm-commits
mailing list