[llvm] [AArch64][SVE] Teach compiler to use information that there are no ac… (PR #68698)

via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 13 04:07:10 PDT 2023


================
@@ -1301,9 +1303,26 @@ static std::optional<Instruction *> instCombineSVEAllActive(IntrinsicInst &II,
   return &II;
 }
 
+// Optimize operations that take an all false predicate or send them for
+// canonicalization.
+static std::optional<Instruction *>
+instCombineSVEAllOrNoActive(InstCombiner &IC, IntrinsicInst &II,
+                            Intrinsic::ID IID) {
+  if (match(II.getOperand(0), m_ZeroInt())) {
+    if (II.getIntrinsicID() != IID)
+      return IC.replaceInstUsesWith(II, II.getOperand(1));
+    else
+      return IC.replaceInstUsesWith(II, UndefValue::get(II.getType()));
----------------
CarolineConcatto wrote:

nit: maybe add a comments
// llvm_ir_u, pred(0), op1, op2   - Spec says to return undef when all lanes are inactive for sv[func]_x

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


More information about the llvm-commits mailing list