[llvm] [Mips] Fix cttz.i32 fails to lower on mips16 (PR #179633)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 10 07:07:31 PST 2026


================
@@ -9694,8 +9691,10 @@ SDValue TargetLowering::expandCTTZ(SDNode *Node, SelectionDAG &DAG) const {
 
   // Emit Table Lookup if ISD::CTPOP used in the fallback path below is going
   // to be expanded or converted to a libcall.
+  const DataLayout &TD = DAG.getDataLayout();
   if (!VT.isVector() && !isOperationLegalOrCustomOrPromote(ISD::CTPOP, VT) &&
-      !isOperationLegal(ISD::CTLZ, VT))
+      !isOperationLegal(ISD::CTLZ, VT) &&
+      isOperationCustom(ISD::ConstantPool, getPointerTy(TD)))
----------------
RKSimon wrote:

Still reckon this check would be better inside CTTZTableLookup - but not going not going to demand it.

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


More information about the llvm-commits mailing list