From ec176e30d655f96d75b49e620a849008bf0f63a2 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 30 Aug 2005 16:56:19 +0000 Subject: [PATCH] Fix a miscompile of PtrDist/bc. Sign extending bools is not the right thing, 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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index 9480ed6f096..db3b33abc51 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -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(Result) && "Didn't constant fold zext?"); break; case ISD::ConstantFP: