summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2013-01-10 22:13:27 +0000
committerEvan Cheng <evan.cheng@apple.com>2013-01-10 22:13:27 +0000
commitc8444b159a8f04bfc15c63cde676108340eba95a (patch)
treee41282557f1613b7d5d4ea7196cb7505ecfec5ab /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
parenta9286e931ce92eb413d1e610a20bbe56b768812e (diff)
downloadbcm5719-llvm-c8444b159a8f04bfc15c63cde676108340eba95a.tar.gz
bcm5719-llvm-c8444b159a8f04bfc15c63cde676108340eba95a.zip
PR14896: Handle memcpy from constant string where the memcpy size is larger than the string size.
llvm-svn: 172124
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 6c29c67808e..344d1447a8d 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -3374,10 +3374,11 @@ static SDValue getMemsetStringVal(EVT VT, DebugLoc dl, SelectionDAG &DAG,
}
assert(!VT.isVector() && "Can't handle vector type here!");
- unsigned NumVTBytes = VT.getSizeInBits() / 8;
+ unsigned NumVTBits = VT.getSizeInBits();
+ unsigned NumVTBytes = NumVTBits / 8;
unsigned NumBytes = std::min(NumVTBytes, unsigned(Str.size()));
- APInt Val(NumBytes*8, 0);
+ APInt Val(NumVTBits, 0);
if (TLI.isLittleEndian()) {
for (unsigned i = 0; i != NumBytes; ++i)
Val |= (uint64_t)(unsigned char)Str[i] << i*8;
OpenPOWER on IntegriCloud