[llvm] [AMDGPU] Remove unnecessary add instructions in ctlz.i8 (PR #77615)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 15 07:33:11 PST 2024


================
@@ -3062,6 +3071,26 @@ static bool isCttzOpc(unsigned Opc) {
   return Opc == ISD::CTTZ || Opc == ISD::CTTZ_ZERO_UNDEF;
 }
 
+SDValue AMDGPUTargetLowering::lowerCTLZResults(SDValue Op,
+                                               SelectionDAG &DAG) const {
+  auto SL = SDLoc(Op);
+  auto Arg = Op.getOperand(0u);
+  auto ResultVT = Op.getValueType();
+
+  if (!(ResultVT == MVT::i8 || ResultVT == MVT::i16))
----------------
jayfoad wrote:

Nit: this can be an assert, and then this function will always succeed so the caller doesn't need a check.

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


More information about the llvm-commits mailing list