[llvm] [AArch64][InstCombine] Fold zext of all-active SVE cmpne-zero (PR #207720)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 9 02:53:13 PDT 2026


================
@@ -2173,13 +2173,44 @@ static std::optional<Instruction *> instCombineXorSVECmpNE(InstCombiner &IC,
   return &II;
 }
 
+// zext(cmpne(ptrue, %v, 0))
+// -> umin(ptrue, %v, 1)
+static std::optional<Instruction *> instCombineZExtSVECmpNE(InstCombiner &IC,
+                                                            IntrinsicInst &II) {
+  if (!isAllActivePredicate(II.getOperand(0)) || !II.hasOneUse())
----------------
paulwalker-arm wrote:

Up to you but perhaps there's no need to restrict on use count. The `umin` and `zext` operations typically have the same latency so overall the cycle counts will be the same, but the latency of the zero extended chain will alway be reduced.

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


More information about the llvm-commits mailing list