diff options
| author | Joel Jones <joel_k_jones@apple.com> | 2012-04-17 22:23:10 +0000 |
|---|---|---|
| committer | Joel Jones <joel_k_jones@apple.com> | 2012-04-17 22:23:10 +0000 |
| commit | 828531f798ab49a546e56245ff876eec27e42a43 (patch) | |
| tree | 2df0e8cce07c5b5d74e63ca1666e31b627b36d47 /llvm/lib/CodeGen/SelectionDAG | |
| parent | 41675546ebfb6d42ae9ff85161b3844528620b3e (diff) | |
| download | bcm5719-llvm-828531f798ab49a546e56245ff876eec27e42a43.tar.gz bcm5719-llvm-828531f798ab49a546e56245ff876eec27e42a43.zip | |
Fixes a problem in instruction selection with testing whether or not the
transformation:
(X op C1) ^ C2 --> (X op C1) & ~C2 iff (C1&C2) == C2
should be done.
This change has been tested:
Using a debug+asserts build:
on the specific test case that brought this bug to light
make check-all
lnt nt
using this clang to build a release version of clang
Using the release+asserts clang-with-clang build:
on the specific test case that brought this bug to light
make check-all
lnt nt
Checking in because Evan wants it checked in. Test case forthcoming after
scrubbing.
llvm-svn: 154955
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp index 09a2b1f3d7a..e341e15e41a 100644 --- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -1367,8 +1367,9 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op, // bits on that side are also known to be set on the other side, turn this // into an AND, as we know the bits will be cleared. // e.g. (X | C1) ^ C2 --> (X | C1) & ~C2 iff (C1&C2) == C2 - if ((NewMask & (KnownZero|KnownOne)) == NewMask) { // all known - if ((KnownOne & KnownOne2) == KnownOne) { + // NB: it is okay if more bits are known than are requested + if ((NewMask & (KnownZero|KnownOne)) == NewMask) { // all known on one side + if (KnownOne == KnownOne2) { // set bits are the same on both sides EVT VT = Op.getValueType(); SDValue ANDC = TLO.DAG.getConstant(~KnownOne & NewMask, VT); return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::AND, dl, VT, |

