[llvm-commits] [llvm] r39839 - /llvm/trunk/lib/Transforms/Scalar/FastDSE.cpp
Owen Anderson
resistor at mac.com
Fri Jul 13 15:50:48 PDT 2007
Author: resistor
Date: Fri Jul 13 17:50:48 2007
New Revision: 39839
URL: http://llvm.org/viewvc/llvm-project?rev=39839&view=rev
Log:
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.
Modified:
llvm/trunk/lib/Transforms/Scalar/FastDSE.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/FastDSE.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/FastDSE.cpp?rev=39839&r1=39838&r2=39839&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/FastDSE.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/FastDSE.cpp Fri Jul 13 17:50:48 2007
@@ -60,9 +60,18 @@
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
More information about the llvm-commits
mailing list