diff options
| author | Owen Anderson <resistor@mac.com> | 2007-07-13 22:50:48 +0000 |
|---|---|---|
| committer | Owen Anderson <resistor@mac.com> | 2007-07-13 22:50:48 +0000 |
| commit | d975efab1629e9b4d68705c5b05f969e74c1ecb3 (patch) | |
| tree | a214853fcaff048543b98644d551b2995faf97e8 /llvm/lib | |
| parent | 355332d3f33f90b40149a594e38893dc82acecb1 (diff) | |
| download | bcm5719-llvm-d975efab1629e9b4d68705c5b05f969e74c1ecb3.tar.gz bcm5719-llvm-d975efab1629e9b4d68705c5b05f969e74c1ecb3.zip | |
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.
llvm-svn: 39839
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/FastDSE.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/FastDSE.cpp b/llvm/lib/Transforms/Scalar/FastDSE.cpp index 13e61366477..901a735e3c0 100644 --- a/llvm/lib/Transforms/Scalar/FastDSE.cpp +++ b/llvm/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 |

