summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2014-04-24 00:01:09 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2014-04-24 00:01:09 +0000
commit60728177fb0f443b5e07a3f65827c510011c0ffe (patch)
tree17b1e424ec064d74352c3e5cc595cf0bb7508082 /llvm/lib/Transforms/InstCombine
parent6a4fee87bca1b78bf0693525f0aafc62ee039d5e (diff)
downloadbcm5719-llvm-60728177fb0f443b5e07a3f65827c510011c0ffe.tar.gz
bcm5719-llvm-60728177fb0f443b5e07a3f65827c510011c0ffe.zip
Handle addrspacecast when looking at memcpys from globals
llvm-svn: 207054
Diffstat (limited to 'llvm/lib/Transforms/InstCombine')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
index 6fea7f2ac22..dceb1a83e5b 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
@@ -31,10 +31,13 @@ STATISTIC(NumGlobalCopies, "Number of allocas copied from constant global");
static bool pointsToConstantGlobal(Value *V) {
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(V))
return GV->isConstant();
- if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V))
+
+ if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V)) {
if (CE->getOpcode() == Instruction::BitCast ||
+ CE->getOpcode() == Instruction::AddrSpaceCast ||
CE->getOpcode() == Instruction::GetElementPtr)
return pointsToConstantGlobal(CE->getOperand(0));
+ }
return false;
}
@@ -62,9 +65,9 @@ isOnlyCopiedFromConstantGlobal(Value *V, MemTransferInst *&TheCopy,
continue;
}
- if (BitCastInst *BCI = dyn_cast<BitCastInst>(I)) {
+ if (isa<BitCastInst>(I) || isa<AddrSpaceCastInst>(I)) {
// If uses of the bitcast are ok, we are ok.
- if (!isOnlyCopiedFromConstantGlobal(BCI, TheCopy, ToDelete, IsOffset))
+ if (!isOnlyCopiedFromConstantGlobal(I, TheCopy, ToDelete, IsOffset))
return false;
continue;
}
OpenPOWER on IntegriCloud