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.

llvm-svn: 39945
This commit is contained in:
Owen Anderson 2007-07-16 23:34:39 +00:00
parent 81f1a6c4cb
commit 09f86993bd
1 changed files with 4 additions and 11 deletions

View File

@ -61,17 +61,10 @@ namespace {
// See through pointer-to-pointer bitcasts // See through pointer-to-pointer bitcasts
while (isa<BitCastInst>(v) || isa<GetElementPtrInst>(v)) while (isa<BitCastInst>(v) || isa<GetElementPtrInst>(v))
if (BitCastInst* C = dyn_cast<BitCastInst>(v)) { if (BitCastInst* C = dyn_cast<BitCastInst>(v))
if (isa<PointerType>(C->getSrcTy())) v = C->getOperand(0);
v = C->getOperand(0); else if (GetElementPtrInst* G = dyn_cast<GetElementPtrInst>(v))
else v = G->getOperand(0);
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 // getAnalysisUsage - We require post dominance frontiers (aka Control