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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 23 07:52:34 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
----------------
arsenm wrote:

Capitalize comment. Also I guess given the vector check above, the vector case doesn't matter? 

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


More information about the llvm-commits mailing list