summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-11-27 04:39:56 +0000
committerChris Lattner <sabre@nondot.org>2006-11-27 04:39:56 +0000
commitdb18938355970d1ff7296c139369bf140690b3bc (patch)
tree760ba1c3f152b76e0c355956bb10a513c45ab2d7 /llvm/lib
parent6c38f0bb071b864a6f2ae7b0cacad1b15f6e3d03 (diff)
downloadbcm5719-llvm-db18938355970d1ff7296c139369bf140690b3bc.tar.gz
bcm5719-llvm-db18938355970d1ff7296c139369bf140690b3bc.zip
If a brcond condition is promoted, make sure to zero extend it, even if not
expanded into BR_CC. llvm-svn: 31932
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index 59f476792a0..a1a595526ba 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -1302,6 +1302,12 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
break;
case Promote:
Tmp2 = PromoteOp(Node->getOperand(1)); // Promote the condition.
+
+ // The top bits of the promoted condition are not necessarily zero, ensure
+ // that the value is properly zero extended.
+ if (!TLI.MaskedValueIsZero(Tmp2,
+ MVT::getIntVTBitMask(Tmp2.getValueType())^1))
+ Tmp2 = DAG.getZeroExtendInReg(Tmp2, MVT::i1);
break;
}
@@ -1323,12 +1329,6 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
Tmp2.getOperand(0), Tmp2.getOperand(1),
Node->getOperand(2));
} else {
- // Make sure the condition is either zero or one. It may have been
- // promoted from something else.
- unsigned NumBits = MVT::getSizeInBits(Tmp2.getValueType());
- if (!TLI.MaskedValueIsZero(Tmp2, (~0ULL >> (64-NumBits))^1))
- Tmp2 = DAG.getZeroExtendInReg(Tmp2, MVT::i1);
-
Result = DAG.getNode(ISD::BR_CC, MVT::Other, Tmp1,
DAG.getCondCode(ISD::SETNE), Tmp2,
DAG.getConstant(0, Tmp2.getValueType()),
OpenPOWER on IntegriCloud