[llvm-branch-commits] [llvm] [SelectionDAG] Handle constants in SimplifyMultipleUseDemandedBits (PR #224882)
Simon Pilgrim via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Sep 21 04:28:49 PDT 2026
================
@@ -766,6 +766,12 @@ SDValue TargetLowering::SimplifyMultipleUseDemandedBits(
unsigned BitWidth = DemandedBits.getBitWidth();
KnownBits LHSKnown, RHSKnown;
switch (Op.getOpcode()) {
+ case ISD::Constant: {
+ const APInt &Value = Op->getAsAPIntVal();
+ if (!Value.isZero() && (Value & DemandedBits).isZero())
----------------
RKSimon wrote:
I'm not sure about adding general constant folding - SimplifyMultipleUseDemandedBits is mainly about bypassing unnecessary nodes not creating new ones - returning zero is probably as far as I'd recommend we go and we should rely on folds making use of ComputeKnownBits to handle other cases.
https://github.com/llvm/llvm-project/pull/224882
More information about the llvm-branch-commits
mailing list