Skip to content

Commit fbbd436

Browse files
committed
[SDAG] Add versions of computeKnownBits that return a value
Having the KnownBits as an output parameter is kind of awkward to use and a holdover from when it was two separate APInts. Instead, just return a KnownBits object. I'm leaving the existing interface in place for now, since updating the callers all at once would be thousands of lines of diff. llvm-svn: 340594
1 parent a7c3846 commit fbbd436

File tree

2 files changed

+95
-95
lines changed

2 files changed

+95
-95
lines changed

llvm/include/llvm/CodeGen/SelectionDAG.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,15 +1434,27 @@ class SelectionDAG {
14341434
/// every vector element.
14351435
/// Targets can implement the computeKnownBitsForTargetNode method in the
14361436
/// TargetLowering class to allow target nodes to be understood.
1437-
void computeKnownBits(SDValue Op, KnownBits &Known, unsigned Depth = 0) const;
1437+
KnownBits computeKnownBits(SDValue Op, unsigned Depth = 0) const;
14381438

14391439
/// Determine which bits of Op are known to be either zero or one and return
14401440
/// them in Known. The DemandedElts argument allows us to only collect the
14411441
/// known bits that are shared by the requested vector elements.
14421442
/// Targets can implement the computeKnownBitsForTargetNode method in the
14431443
/// TargetLowering class to allow target nodes to be understood.
1444+
KnownBits computeKnownBits(SDValue Op, const APInt &DemandedElts,
1445+
unsigned Depth = 0) const;
1446+
1447+
/// \copydoc SelectionDAG::computeKnownBits(SDValue,unsigned)
1448+
void computeKnownBits(SDValue Op, KnownBits &Known,
1449+
unsigned Depth = 0) const {
1450+
Known = computeKnownBits(Op, Depth);
1451+
}
1452+
1453+
/// \copydoc SelectionDAG::computeKnownBits(SDValue,const APInt&,unsigned)
14441454
void computeKnownBits(SDValue Op, KnownBits &Known, const APInt &DemandedElts,
1445-
unsigned Depth = 0) const;
1455+
unsigned Depth = 0) const {
1456+
Known = computeKnownBits(Op, DemandedElts, Depth);
1457+
}
14461458

14471459
/// Used to represent the possible overflow behavior of an operation.
14481460
/// Never: the operation cannot overflow.

0 commit comments

Comments
 (0)