summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff options
context:
space:
mode:
authorNate Begeman <natebegeman@mac.com>2005-04-14 08:56:52 +0000
committerNate Begeman <natebegeman@mac.com>2005-04-14 08:56:52 +0000
commit80c095f4221de79a157a5ea962b6701bf9648134 (patch)
treecfb37a0e421d6ba77123ba8de3a4d685fa77b8e1 /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
parentf6b666fb06927253ad5893cf6a09a2509d7f2f41 (diff)
downloadbcm5719-llvm-80c095f4221de79a157a5ea962b6701bf9648134.tar.gz
bcm5719-llvm-80c095f4221de79a157a5ea962b6701bf9648134.zip
Add a couple missing transforms in getSetCC that were triggering assertions
in the PPC Pattern ISel llvm-svn: 21297
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 1926c2adb5b..6790adb9d2c 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -436,11 +436,18 @@ SDOperand SelectionDAG::getSetCC(ISD::CondCode Cond, MVT::ValueType VT,
N2C = cast<ConstantSDNode>(N2.Val);
}
+ if ((Cond == ISD::SETLT || Cond == ISD::SETULT) && C2 == MinVal)
+ return getConstant(0, VT); // X < MIN --> false
+
+ // Canonicalize setgt X, Min --> setne X, Min
+ if ((Cond == ISD::SETGT || Cond == ISD::SETUGT) && C2 == MinVal)
+ return getSetCC(ISD::SETNE, VT, N1, N2);
+
// If we have setult X, 1, turn it into seteq X, 0
if ((Cond == ISD::SETLT || Cond == ISD::SETULT) && C2 == MinVal+1)
return getSetCC(ISD::SETEQ, VT, N1,
getConstant(MinVal, N1.getValueType()));
- // If we have setult X, 1, turn it into seteq X, 0
+ // If we have setugt X, Max-1, turn it into seteq X, Max
else if ((Cond == ISD::SETGT || Cond == ISD::SETUGT) && C2 == MaxVal-1)
return getSetCC(ISD::SETEQ, VT, N1,
getConstant(MaxVal, N1.getValueType()));
OpenPOWER on IntegriCloud