[llvm] Optimize count leading ones if promoted type (PR #99591)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 24 02:16:40 PDT 2024


================
@@ -2298,8 +2298,29 @@ static bool despeculateCountZeros(IntrinsicInst *CountZeros,
   if (match(CountZeros->getOperand(1), m_One()))
     return false;
 
-  // If it's cheap to speculate, there's nothing to do.
   Type *Ty = CountZeros->getType();
+  EVT VTy = TLI->getValueType(*DL, Ty);
+
+  // do not despeculate if we have (ctlz (xor op -1)) if the operand is
----------------
v01dXYZ wrote:

I made a mistake though since I should have used `InstructionOpcodeToISD`.

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


More information about the llvm-commits mailing list