From: Chris Lattner Date: Mon, 20 Feb 2006 06:38:35 +0000 (+0000) Subject: Fix a problem on itanium with memset. The value to set has been promoted to X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=dca7abed918c8191de6e258ddf394cf11de240f2;p=oota-llvm.git Fix a problem on itanium with memset. The value to set has been promoted to i64 before this code, so zero_ext doesn't work. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26290 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index 5a45323c38a..67877c3d5f7 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -1661,8 +1661,12 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { const char *FnName = 0; if (Node->getOpcode() == ISD::MEMSET) { Args.push_back(std::make_pair(Tmp2, IntPtrTy)); - // Extend the ubyte argument to be an int value for the call. - Tmp3 = DAG.getNode(ISD::ZERO_EXTEND, MVT::i32, Tmp3); + // Extend the (previously legalized) ubyte argument to be an int value + // for the call. + if (Tmp3.getValueType() > MVT::i32) + Tmp3 = DAG.getNode(ISD::TRUNCATE, MVT::i32, Tmp3); + else + Tmp3 = DAG.getNode(ISD::ZERO_EXTEND, MVT::i32, Tmp3); Args.push_back(std::make_pair(Tmp3, Type::IntTy)); Args.push_back(std::make_pair(Tmp4, IntPtrTy));