[clang] [llvm] [AArch64][SVE] Refactor getPTrue to return splat(1) when pattern=all. (PR #139236)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Fri May 9 04:03:49 PDT 2025


================
@@ -25030,7 +25030,8 @@ static SDValue foldCSELofLASTB(SDNode *Op, SelectionDAG &DAG) {
   if (AnyPred.getOpcode() == AArch64ISD::REINTERPRET_CAST)
     AnyPred = AnyPred.getOperand(0);
 
-  if (TruePred != AnyPred && TruePred.getOpcode() != AArch64ISD::PTRUE)
+  if (TruePred != AnyPred && TruePred.getOpcode() != AArch64ISD::PTRUE &&
+      !ISD::isConstantSplatVectorAllOnes(TruePred.getNode()))
----------------
paulwalker-arm wrote:

I think the original code here is broken  because I don't see how you can ignore the `PTRUE`'s pattern?  My guess is this line is essentially asking "Are all the active bits in `AnyPred` also active in `TruePred`?" and the `PTRUE` check is bing incorrectly used to match an all true predicate.

If true then with this PR I think you can just remove the `PTRUE` check because your new code asks exactly that question.

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


More information about the llvm-commits mailing list