diff options
author | Chris Lattner <sabre@nondot.org> | 2005-09-09 23:00:07 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-09-09 23:00:07 +0000 |
commit | 331b311f7b1c895e5491681ebff78fadfca3b5f3 (patch) | |
tree | 3c3c37960b962e424385e89f6b6833e362a6124c /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | 16e5cb87baac018ca48d3cb80854f7a14228b063 (diff) | |
download | bcm5719-llvm-331b311f7b1c895e5491681ebff78fadfca3b5f3.tar.gz bcm5719-llvm-331b311f7b1c895e5491681ebff78fadfca3b5f3.zip |
Fix a problem duraid encountered on itanium where this folding:
select (x < y), 1, 0 -> (x < y) incorrectly: the setcc returns i1 but the
select returned i32. Add the zero extend as needed.
llvm-svn: 23301
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index c27523ae131..79ba3d20420 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -974,8 +974,12 @@ SDOperand SelectionDAG::SimplifySelectCC(SDOperand N1, SDOperand N2, // Check to see if this is the equivalent of setcc if (N4C && N4C->isNullValue() && N3C && (N3C->getValue() == 1ULL)) { MVT::ValueType XType = N1.getValueType(); - if (TLI.isOperationLegal(ISD::SETCC, TLI.getSetCCResultTy())) - return getSetCC(TLI.getSetCCResultTy(), N1, N2, CC); + if (TLI.isOperationLegal(ISD::SETCC, TLI.getSetCCResultTy())) { + SDOperand Res = getSetCC(TLI.getSetCCResultTy(), N1, N2, CC); + if (Res.getValueType() != VT) + Res = getNode(ISD::ZERO_EXTEND, VT, Res); + return Res; + } // seteq X, 0 -> srl (ctlz X, log2(size(X))) if (N2C && N2C->isNullValue() && CC == ISD::SETEQ && |