Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions llvm/lib/Analysis/ValueTracking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why isn't this Known = Known2.reverseBits()?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or why isn't the abs case Known = Known.unionWith(Known2.abs(IntMinIsPoison));?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess they should all use unionWith, to take advantage of any ConstantRange info that might have been calculated before this switch.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bitreverse and bswap started doing the union here ad5c2d0. abs was added later.

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);
Expand Down
6 changes: 2 additions & 4 deletions llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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: {
Expand Down