summaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2014-01-02 20:01:43 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2014-01-02 20:01:43 +0000
commite13db1008b07fc1f367b0a99ab0c3ba6fb057fc9 (patch)
tree38958b38c979e46ebf0a644075ef9a3598973b39 /lib/Transforms
parent1085cc12629e3f60e9934ea41a1448dba9303188 (diff)
downloadllvm-e13db1008b07fc1f367b0a99ab0c3ba6fb057fc9.tar.gz
llvm-e13db1008b07fc1f367b0a99ab0c3ba6fb057fc9.tar.bz2
llvm-e13db1008b07fc1f367b0a99ab0c3ba6fb057fc9.tar.xz
Delete unread globals through addrspacecast
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198346 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/IPO/GlobalOpt.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp
index 40ebdea45b..611d81063c 100644
--- a/lib/Transforms/IPO/GlobalOpt.cpp
+++ b/lib/Transforms/IPO/GlobalOpt.cpp
@@ -297,8 +297,9 @@ static bool CleanupConstantGlobalUsers(Value *V, Constant *Init,
if (Init)
SubInit = ConstantFoldLoadThroughGEPConstantExpr(Init, CE);
Changed |= CleanupConstantGlobalUsers(CE, SubInit, TD, TLI);
- } else if (CE->getOpcode() == Instruction::BitCast &&
- CE->getType()->isPointerTy()) {
+ } else if ((CE->getOpcode() == Instruction::BitCast &&
+ CE->getType()->isPointerTy()) ||
+ CE->getOpcode() == Instruction::AddrSpaceCast) {
// Pointer cast, delete any stores and memsets to the global.
Changed |= CleanupConstantGlobalUsers(CE, 0, TD, TLI);
}