[llvm] [AArch64] optimise SVE cvt intrinsics with no active lanes (PR #104809)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 20 10:37:34 PDT 2024
================
@@ -1073,6 +1073,32 @@ static bool isAllActivePredicate(Value *Pred) {
m_ConstantInt<AArch64SVEPredPattern::all>()));
}
+// Simplify unary operation where predicate has all inactive lanes by replacing
+// instruction with its operand
+static std::optional<Instruction *>
+instCombineSVENoActiveUnaryReplace(InstCombiner &IC, IntrinsicInst &II,
+ bool hasInactiveVector) {
+ int PredOperand = hasInactiveVector ? 1 : 0;
+ int ReplaceOperand = hasInactiveVector ? 0 : 1;
+ if (match(II.getOperand(PredOperand), m_ZeroInt())) {
+ IC.replaceInstUsesWith(II, II.getOperand(ReplaceOperand));
+ return IC.eraseInstFromFunction(II);
+ }
+ return std::nullopt;
+}
+
+// Simplify unary operation where predicate has all inactive lanes or try to
+// replace with _x form when all lanes are active
----------------
SpencerAbson wrote:
Would you elaborate on the benefit of replacing it with the `_x` form? Also, I'm not sure that this replacement is tested in this patch - I see only `zeroinitializer` predicates.
https://github.com/llvm/llvm-project/pull/104809
More information about the llvm-commits
mailing list