[llvm] [ValueTracking][SelectionDAG] Use KnownBits::reverseBits/byteSwap. NFC (PR #155847)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 28 07:56:32 PDT 2025
https://github.com/topperc created https://github.com/llvm/llvm-project/pull/155847
None
>From d462f874c2a2e5b535cfb963e696189e0a592712 Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Thu, 28 Aug 2025 07:55:42 -0700
Subject: [PATCH] [ValueTracking][SelectionDAG] Use
KnownBits::reverseBits/byteSwap. NFC
---
llvm/lib/Analysis/ValueTracking.cpp | 6 ++----
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | 6 ++----
2 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 7fe129b8456f6..e6282fc8cdbbc 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -1834,13 +1834,11 @@ static void computeKnownBitsFromOperator(const Operator *I,
}
case Intrinsic::bitreverse:
computeKnownBits(I->getOperand(0), DemandedElts, Known2, Q, Depth + 1);
- Known.Zero |= Known2.Zero.reverseBits();
- Known.One |= Known2.One.reverseBits();
+ Known = Known.unionWith(Known2.reverseBits());
break;
case Intrinsic::bswap:
computeKnownBits(I->getOperand(0), DemandedElts, Known2, Q, Depth + 1);
- Known.Zero |= Known2.Zero.byteSwap();
- Known.One |= Known2.One.byteSwap();
+ Known = Known.unionWith(Known2.byteSwap());
break;
case Intrinsic::ctlz: {
computeKnownBits(I->getOperand(0), DemandedElts, Known2, Q, Depth + 1);
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index 402a012e8e555..7e5844d1a8963 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -2363,8 +2363,7 @@ bool TargetLowering::SimplifyDemandedBits(
if (SimplifyDemandedBits(Src, DemandedSrcBits, DemandedElts, Known2, TLO,
Depth + 1))
return true;
- Known.One = Known2.One.reverseBits();
- Known.Zero = Known2.Zero.reverseBits();
+ Known = Known2.reverseBits();
break;
}
case ISD::BSWAP: {
@@ -2397,8 +2396,7 @@ bool TargetLowering::SimplifyDemandedBits(
if (SimplifyDemandedBits(Src, DemandedSrcBits, DemandedElts, Known2, TLO,
Depth + 1))
return true;
- Known.One = Known2.One.byteSwap();
- Known.Zero = Known2.Zero.byteSwap();
+ Known = Known2.byteSwap();
break;
}
case ISD::CTPOP: {
More information about the llvm-commits
mailing list