aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2007-07-13 22:50:48 +0000
committerOwen Anderson <resistor@mac.com>2007-07-13 22:50:48 +0000
commita08971559d6393307070ec970e35240eb0598deb (patch)
tree479fddb6826f1c07903096559fa2d474bf309230 /lib
parentfba36b8cbabcc0a457484bb2babe71a5f570435c (diff)
downloadexternal_llvm-a08971559d6393307070ec970e35240eb0598deb.zip
external_llvm-a08971559d6393307070ec970e35240eb0598deb.tar.gz
external_llvm-a08971559d6393307070ec970e35240eb0598deb.tar.bz2
Handle GEPs with all-zero indices in the same way we handle pointer-pointer bitcasts. Also, fix a potentia infinite loop.
This brings FastDSE to parity with old DSE on 175.vpr. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39839 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Scalar/FastDSE.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/Transforms/Scalar/FastDSE.cpp b/lib/Transforms/Scalar/FastDSE.cpp
index 13e6136..901a735 100644
--- a/lib/Transforms/Scalar/FastDSE.cpp
+++ b/lib/Transforms/Scalar/FastDSE.cpp
@@ -60,9 +60,18 @@ namespace {
assert(isa<PointerType>(v->getType()) && "Translating a non-pointer type?");
// See through pointer-to-pointer bitcasts
- while (BitCastInst* C = dyn_cast<BitCastInst>(v))
- if (isa<PointerType>(C->getSrcTy()))
- v = C->getOperand(0);
+ while (isa<BitCastInst>(v) || isa<GetElementPtrInst>(v))
+ if (BitCastInst* C = dyn_cast<BitCastInst>(v)) {
+ if (isa<PointerType>(C->getSrcTy()))
+ v = C->getOperand(0);
+ else
+ break;
+ } else if (GetElementPtrInst* G = dyn_cast<GetElementPtrInst>(v)) {
+ if (G->hasAllZeroIndices())
+ v = G->getOperand(0);
+ else
+ break;
+ }
}
// getAnalysisUsage - We require post dominance frontiers (aka Control