Fix a miscompile of PtrDist/bc. Sign extending bools is not the right thing,
authorChris Lattner <sabre@nondot.org>
Tue, 30 Aug 2005 16:56:19 +0000 (16:56 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 30 Aug 2005 16:56:19 +0000 (16:56 +0000)
at least tends to expose problems elsewhere.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23149 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

index 9480ed6f096acf8fa29d856b269c448adcbe2ec5..db3b33abc51ebd8d2903de6daf287d664126fb90 100644 (file)
@@ -2011,7 +2011,10 @@ SDOperand SelectionDAGLegalize::PromoteOp(SDOperand Op) {
     Result = DAG.getNode(ISD::UNDEF, NVT);
     break;
   case ISD::Constant:
-    Result = DAG.getNode(ISD::SIGN_EXTEND, NVT, Op);
+    if (VT != MVT::i1)
+      Result = DAG.getNode(ISD::SIGN_EXTEND, NVT, Op);
+    else
+      Result = DAG.getNode(ISD::ZERO_EXTEND, NVT, Op);
     assert(isa<ConstantSDNode>(Result) && "Didn't constant fold zext?");
     break;
   case ISD::ConstantFP: