[llvm] Power of 2 SDValue is known to be power of 2 after dag ops BSWAP/BITREVERSE (PR #182207)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 18 17:53:49 PST 2026


================
@@ -4762,6 +4762,10 @@ bool SelectionDAG::isKnownToBeAPowerOfTwo(SDValue Val,
         isKnownToBeAPowerOfTwo(Val.getOperand(0), /*OrZero=*/false, Depth + 1))
       return true;
     break;
+  case ISD::BSWAP:
+  case ISD::BITREVERSE:
+    isKnownToBeAPowerOfTwo(Val.getOperand(0), /*OrZero=*/false, Depth + 1);
----------------
topperc wrote:

Can we pass along the `OrZero` flag? I believe that's what ValueTracking.cpp does.

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


More information about the llvm-commits mailing list