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

via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 24 02:09:25 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'll capitalise the comment but I don't understand why the check for TypeAction/OperationAction is not right in the case of a vector type (although here it's valid b/c previous check ensuring it's not a vector type).

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


More information about the llvm-commits mailing list