diff options
author | Micah Villmow <villmow@gmail.com> | 2012-10-11 17:21:41 +0000 |
---|---|---|
committer | Micah Villmow <villmow@gmail.com> | 2012-10-11 17:21:41 +0000 |
commit | f3840d2c16a4ec4c879a8ded402835746de380f8 (patch) | |
tree | 705fb3f3aea368f4880d2d672312e6b783528718 /lib/Analysis/CodeMetrics.cpp | |
parent | ebba49395c189364c9ef77fb4c432856330ceca1 (diff) |
Add in the first iteration of support for llvm/clang/lldb to allow variable per address space pointer sizes to be optimized correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165726 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CodeMetrics.cpp')
-rw-r--r-- | lib/Analysis/CodeMetrics.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Analysis/CodeMetrics.cpp b/lib/Analysis/CodeMetrics.cpp index 651a54be1b..d669268496 100644 --- a/lib/Analysis/CodeMetrics.cpp +++ b/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 |