summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-02-20 06:38:35 +0000
committerChris Lattner <sabre@nondot.org>2006-02-20 06:38:35 +0000
commit486d1bc5edf05c2ebc930ca2d6eaa561e9813da5 (patch)
tree9623d3de5e9ad803a811421da61a6dccfc97c565 /llvm/lib/CodeGen
parentc2e3a7a4ce519dadaabeacc2528f2d40e9b8a11f (diff)
downloadbcm5719-llvm-486d1bc5edf05c2ebc930ca2d6eaa561e9813da5.tar.gz
bcm5719-llvm-486d1bc5edf05c2ebc930ca2d6eaa561e9813da5.zip
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. llvm-svn: 26290
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index 5a45323c38a..67877c3d5f7 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/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));
OpenPOWER on IntegriCloud