[llvm] [SelectionDAG] Fold (avg x, 0) -> x >> 1 (PR #85581)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 18 08:38:56 PDT 2024
================
@@ -5083,7 +5083,18 @@ SDValue DAGCombiner::visitAVG(SDNode *N) {
if (N0 == N1 && Level >= AfterLegalizeTypes)
return N0;
- // TODO If we use avg for scalars anywhere, we can add (avgfl x, 0) -> x >> 1
+ // Fold (avg x, 0) -> x >> 1
+ if (isNullOrNullSplat(N0))
----------------
AtariDreams wrote:
Not the same behavior. isNullOrNullSplat returns false if there are any undefs in the vector.
https://github.com/llvm/llvm-project/pull/85581
More information about the llvm-commits
mailing list