From ce17b1c1f8761f5fabb4b0531b7127254cdc89de Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Mon, 16 Jul 2007 23:34:39 +0000 Subject: [PATCH] Take advantage of undefined behavior if the source program tries to GEP beyond the end of an alloca to make FastDSE faster and more aggressive. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39945 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/FastDSE.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/lib/Transforms/Scalar/FastDSE.cpp b/lib/Transforms/Scalar/FastDSE.cpp index 45985ba7175..72857b9c47a 100644 --- a/lib/Transforms/Scalar/FastDSE.cpp +++ b/lib/Transforms/Scalar/FastDSE.cpp @@ -61,17 +61,10 @@ namespace { // See through pointer-to-pointer bitcasts while (isa(v) || isa(v)) - if (BitCastInst* C = dyn_cast(v)) { - if (isa(C->getSrcTy())) - v = C->getOperand(0); - else - break; - } else if (GetElementPtrInst* G = dyn_cast(v)) { - if (G->hasAllZeroIndices()) - v = G->getOperand(0); - else - break; - } + if (BitCastInst* C = dyn_cast(v)) + v = C->getOperand(0); + else if (GetElementPtrInst* G = dyn_cast(v)) + v = G->getOperand(0); } // getAnalysisUsage - We require post dominance frontiers (aka Control