summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorJustin Holewinski <jholewinski@nvidia.com>2015-02-02 21:05:49 +0000
committerJustin Holewinski <jholewinski@nvidia.com>2015-02-02 21:05:49 +0000
commitf39158f96ec916ec8b4f9838f1cbc76d13038ab3 (patch)
tree7d1368df12322166b10ea3f6093c8d78004ae6a2 /lib/CodeGen/CodeGenModule.cpp
parent7ff13b67a465705a2c9c0313afcd4ffde8779323 (diff)
downloadclang-f39158f96ec916ec8b4f9838f1cbc76d13038ab3.tar.gz
When generating llvm.used, we may need an addrspacecast instead of a bitcast.
Summary: This is especially important for targets that use multiple address spaces, and commonly place global variables in address spaces other than zero. Fixes PR22383 Test Plan: New test case added: llvm-used.cu Reviewers: jingyue Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D7345 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227861 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--lib/CodeGen/CodeGenModule.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index c710b5bdad..dc7ec6f654 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -935,8 +935,8 @@ static void emitUsed(CodeGenModule &CGM, StringRef Name,
UsedArray.resize(List.size());
for (unsigned i = 0, e = List.size(); i != e; ++i) {
UsedArray[i] =
- llvm::ConstantExpr::getBitCast(cast<llvm::Constant>(&*List[i]),
- CGM.Int8PtrTy);
+ llvm::ConstantExpr::getPointerBitCastOrAddrSpaceCast(
+ cast<llvm::Constant>(&*List[i]), CGM.Int8PtrTy);
}
if (UsedArray.empty())