diff options
author | Micah Villmow <villmow@gmail.com> | 2012-10-15 16:24:29 +0000 |
---|---|---|
committer | Micah Villmow <villmow@gmail.com> | 2012-10-15 16:24:29 +0000 |
commit | 4bb926d91dbd9842c20dbeb0d6abea7dee36e1fa (patch) | |
tree | 882e998a0f6267013cf4b5a4e827cc007d11084b /llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp | |
parent | ef206f19a4be428092b173339df138a3c17e1687 (diff) | |
download | bcm5719-llvm-4bb926d91dbd9842c20dbeb0d6abea7dee36e1fa.tar.gz bcm5719-llvm-4bb926d91dbd9842c20dbeb0d6abea7dee36e1fa.zip |
Resubmit the changes to llvm core to update the functions to support different pointer sizes on a per address space basis.
llvm-svn: 165941
Diffstat (limited to 'llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp b/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp index 517657cf526..97fff9edd68 100644 --- a/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp +++ b/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp @@ -174,10 +174,11 @@ bool MemsetRange::isProfitableToUseMemset(const DataLayout &TD) const { // this width can be stored. If so, check to see whether we will end up // actually reducing the number of stores used. unsigned Bytes = unsigned(End-Start); - unsigned NumPointerStores = Bytes/TD.getPointerSize(); + unsigned AS = cast<StoreInst>(TheStores[0])->getPointerAddressSpace(); + unsigned NumPointerStores = Bytes/TD.getPointerSize(AS); // Assume the remaining bytes if any are done a byte at a time. - unsigned NumByteStores = Bytes - NumPointerStores*TD.getPointerSize(); + unsigned NumByteStores = Bytes - NumPointerStores*TD.getPointerSize(AS); // If we will reduce the # stores (according to this heuristic), do the // transformation. This encourages merging 4 x i8 -> i32 and 2 x i16 -> i32 |