[PATCH] D128911: Emit table lookup from TargetLowering::expandCTTZ()

Shubham Narlawar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 4 11:21:59 PDT 2022


gsocshubham added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:7974
+      DAG.getConstant(ShiftAmt, dl, VT));
+
+  SmallVector<uint8_t> Table(BitWidth, 0);
----------------
craig.topper wrote:
> The RISC-V crash needs this to fix
> 
> ```
> Lookup = DAG.getSExtOrTrunc(Lookup, dl, getPointerTy(TD));
> ```
> 
> 
> Still looking at AVR
Added above line!


================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:8037
+      !isOperationLegal(ISD::CTLZ, VT))
+    return CTTZTableLookup(Node, DAG, dl, VT, Op, NumBitsPerElt);
+
----------------
craig.topper wrote:
> craig.topper wrote:
> > This needs to be
> > 
> > ```
> > if (SDValue V = CTTZTableLookup(Node, DAG, dl, VT, Op, NumBitsPerElt))
> >   return V;
> > ```
> > 
> > Because there is an early out in CTTZTableLookup for types other than i32/i64.
> That will fix the AVR failure
Updated as above.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128911/new/

https://reviews.llvm.org/D128911



More information about the llvm-commits mailing list