[llvm] [LegalizeTypes] Don't pad cttz_elts_zero_poison with ones when widening op (PR #206705)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 30 07:20:59 PDT 2026


================
@@ -8730,12 +8730,18 @@ SDValue DAGTypeLegalizer::WidenVecOp_VSELECT(SDNode *N) {
 SDValue DAGTypeLegalizer::WidenVecOp_CttzElements(SDNode *N) {
   SDLoc DL(N);
   SDValue Source = N->getOperand(0);
-  EVT WideVT = GetWidenedVector(Source).getValueType();
+  EVT WideVT =
+      TLI.getTypeToTransformTo(*DAG.getContext(), Source.getValueType());
 
-  // Pad the widened portion with all-ones so the extra lanes appear as
-  // active (non-zero) elements and do not contribute trailing zeros.
-  SDValue AllOnes = DAG.getAllOnesConstant(DL, WideVT);
-  SDValue WideSource = DAG.getInsertSubvector(DL, AllOnes, Source, 0);
+  SDValue WideSource;
+  if (N->getOpcode() == ISD::CTTZ_ELTS_ZERO_POISON)
----------------
topperc wrote:

braces

https://github.com/llvm/llvm-project/pull/206705


More information about the llvm-commits mailing list