diff options
author | Tim Northover <tnorthover@apple.com> | 2013-09-06 12:38:12 +0000 |
---|---|---|
committer | Tim Northover <tnorthover@apple.com> | 2013-09-06 12:38:12 +0000 |
commit | 950fcc0577a09afb50aeb604d41ecf5fdf1ace70 (patch) | |
tree | 85d25d03cdf390b8dbdcec5ac476acc328d0fc90 /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | d719f5281ccec8b4b216c6fbb534ce316b74ed7e (diff) | |
download | bcm5719-llvm-950fcc0577a09afb50aeb604d41ecf5fdf1ace70.tar.gz bcm5719-llvm-950fcc0577a09afb50aeb604d41ecf5fdf1ace70.zip |
SelectionDAG: create correct BooleanContent constants
Occasionally DAGCombiner can spot that a SETCC operation is completely
redundant and reduce it to "all true" or "all false". If this happens to a
vector, the value produced has to take account of what a normal comparison
would have produced, which may be an all-1s bitmask.
The fix in SelectionDAG.cpp is tested, however, as far as I can see the code in
TargetLowering.cpp is possibly unreachable and almost certainly irrelevant when
triggered so there are no tests. However, I believe it's still clearly the
right change and may save someone else some hassle if it suddenly becomes
reachable. So I'm doing it anyway.
llvm-svn: 190147
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 95dc5ab657d..1472490cca8 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -1554,7 +1554,12 @@ SDValue SelectionDAG::FoldSetCC(EVT VT, SDValue N1, case ISD::SETFALSE: case ISD::SETFALSE2: return getConstant(0, VT); case ISD::SETTRUE: - case ISD::SETTRUE2: return getConstant(1, VT); + case ISD::SETTRUE2: { + const TargetLowering *TLI = TM.getTargetLowering(); + TargetLowering::BooleanContent Cnt = TLI->getBooleanContents(VT.isVector()); + return getConstant( + Cnt == TargetLowering::ZeroOrNegativeOneBooleanContent ? -1ULL : 1, VT); + } case ISD::SETOEQ: case ISD::SETOGT: |