diff options
| author | Chris Lattner <sabre@nondot.org> | 2006-11-27 21:50:02 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2006-11-27 21:50:02 +0000 |
| commit | 5d5916b4d10bbc00796870ec63f24d96b07ef499 (patch) | |
| tree | 21774f3f32cd1d60f0fe5aa8668d2a3952164152 /llvm | |
| parent | f36cc15a84d962e2521b40f312104952abe77af5 (diff) | |
| download | bcm5719-llvm-5d5916b4d10bbc00796870ec63f24d96b07ef499.tar.gz bcm5719-llvm-5d5916b4d10bbc00796870ec63f24d96b07ef499.zip | |
Fix the dag combiner bug corresponding to PR1014.
llvm-svn: 31943
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp index 57510ebc741..41828b5ef7c 100644 --- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -363,20 +363,20 @@ bool TargetLowering::SimplifyDemandedBits(SDOperand Op, uint64_t DemandedMask, return TLO.CombineTo(Op, Op.getOperand(0)); if ((DemandedMask & KnownZero2) == DemandedMask) return TLO.CombineTo(Op, Op.getOperand(1)); + + // If all of the unknown bits are known to be zero on one side or the other + // (but not both) turn this into an *inclusive* or. + // e.g. (A & C1)^(B & C2) -> (A & C1)|(B & C2) iff C1&C2 == 0 + if ((DemandedMask & ~KnownZero & ~KnownZero2) == 0) + return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::OR, Op.getValueType(), + Op.getOperand(0), + Op.getOperand(1))); // Output known-0 bits are known if clear or set in both the LHS & RHS. KnownZeroOut = (KnownZero & KnownZero2) | (KnownOne & KnownOne2); // Output known-1 are known to be set if set in only one of the LHS, RHS. KnownOneOut = (KnownZero & KnownOne2) | (KnownOne & KnownZero2); - // If all of the unknown bits are known to be zero on one side or the other - // (but not both) turn this into an *inclusive* or. - // e.g. (A & C1)^(B & C2) -> (A & C1)|(B & C2) iff C1&C2 == 0 - if (uint64_t UnknownBits = DemandedMask & ~(KnownZeroOut|KnownOneOut)) - if ((UnknownBits & (KnownZero|KnownZero2)) == UnknownBits) - return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::OR, Op.getValueType(), - Op.getOperand(0), - Op.getOperand(1))); // If all of the demanded bits on one side are known, and all of the set // 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. |

