summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/CodeMetrics.cpp
diff options
context:
space:
mode:
authorMicah Villmow <villmow@gmail.com>2012-10-15 16:24:29 +0000
committerMicah Villmow <villmow@gmail.com>2012-10-15 16:24:29 +0000
commit4bb926d91dbd9842c20dbeb0d6abea7dee36e1fa (patch)
tree882e998a0f6267013cf4b5a4e827cc007d11084b /llvm/lib/Analysis/CodeMetrics.cpp
parentef206f19a4be428092b173339df138a3c17e1687 (diff)
downloadbcm5719-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/Analysis/CodeMetrics.cpp')
-rw-r--r--llvm/lib/Analysis/CodeMetrics.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/CodeMetrics.cpp b/llvm/lib/Analysis/CodeMetrics.cpp
index 651a54be1b9..d6692684960 100644
--- a/llvm/lib/Analysis/CodeMetrics.cpp
+++ b/llvm/lib/Analysis/CodeMetrics.cpp
@@ -91,14 +91,16 @@ bool llvm::isInstructionFree(const Instruction *I, const DataLayout *TD) {
// which doesn't contain values outside the range of a pointer.
if (isa<IntToPtrInst>(CI) && TD &&
TD->isLegalInteger(Op->getType()->getScalarSizeInBits()) &&
- Op->getType()->getScalarSizeInBits() <= TD->getPointerSizeInBits())
+ Op->getType()->getScalarSizeInBits() <= TD->getPointerSizeInBits(
+ cast<IntToPtrInst>(CI)->getAddressSpace()))
return true;
// A ptrtoint cast is free so long as the result is large enough to store
// the pointer, and a legal integer type.
if (isa<PtrToIntInst>(CI) && TD &&
TD->isLegalInteger(Op->getType()->getScalarSizeInBits()) &&
- Op->getType()->getScalarSizeInBits() >= TD->getPointerSizeInBits())
+ Op->getType()->getScalarSizeInBits() >= TD->getPointerSizeInBits(
+ cast<PtrToIntInst>(CI)->getPointerAddressSpace()))
return true;
// trunc to a native type is free (assuming the target has compare and
OpenPOWER on IntegriCloud