aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-12-08 00:23:35 +0000
committerBill Wendling <isanbard@gmail.com>2013-12-08 00:23:35 +0000
commitcf5f97edf1355be0d7847c73559f8f2b73b54074 (patch)
tree9a9486e369d9f00af98d839ce6a5d3fbfb8bc2ba /lib
parentb7e206eab9de36cefa28ca79b560772d69cfa607 (diff)
downloadexternal_llvm-cf5f97edf1355be0d7847c73559f8f2b73b54074.zip
external_llvm-cf5f97edf1355be0d7847c73559f8f2b73b54074.tar.gz
external_llvm-cf5f97edf1355be0d7847c73559f8f2b73b54074.tar.bz2
Merging r196637:
------------------------------------------------------------------------ r196637 | arsenm | 2013-12-06 18:58:41 -0800 (Fri, 06 Dec 2013) | 1 line Add getBitCastOrAddrSpaceCast ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_34@196707 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/IR/Constants.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/IR/Constants.cpp b/lib/IR/Constants.cpp
index a8a325a..690ac59 100644
--- a/lib/IR/Constants.cpp
+++ b/lib/IR/Constants.cpp
@@ -1499,7 +1499,18 @@ Constant *ConstantExpr::getPointerCast(Constant *S, Type *Ty) {
return getBitCast(S, Ty);
}
-Constant *ConstantExpr::getIntegerCast(Constant *C, Type *Ty,
+Constant *ConstantExpr::getPointerBitCastOrAddrSpaceCast(Constant *S,
+ Type *Ty) {
+ assert(S->getType()->isPtrOrPtrVectorTy() && "Invalid cast");
+ assert(Ty->isPtrOrPtrVectorTy() && "Invalid cast");
+
+ if (S->getType()->getPointerAddressSpace() != Ty->getPointerAddressSpace())
+ return getAddrSpaceCast(S, Ty);
+
+ return getBitCast(S, Ty);
+}
+
+Constant *ConstantExpr::getIntegerCast(Constant *C, Type *Ty,
bool isSigned) {
assert(C->getType()->isIntOrIntVectorTy() &&
Ty->isIntOrIntVectorTy() && "Invalid cast");