mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
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
This commit is contained in:
parent
cfdf3b6eff
commit
9ade055c0f
@ -60,9 +60,18 @@ namespace {
|
|||||||
assert(isa<PointerType>(v->getType()) && "Translating a non-pointer type?");
|
assert(isa<PointerType>(v->getType()) && "Translating a non-pointer type?");
|
||||||
|
|
||||||
// See through pointer-to-pointer bitcasts
|
// See through pointer-to-pointer bitcasts
|
||||||
while (BitCastInst* C = dyn_cast<BitCastInst>(v))
|
while (isa<BitCastInst>(v) || isa<GetElementPtrInst>(v))
|
||||||
if (isa<PointerType>(C->getSrcTy()))
|
if (BitCastInst* C = dyn_cast<BitCastInst>(v)) {
|
||||||
v = C->getOperand(0);
|
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
|
// getAnalysisUsage - We require post dominance frontiers (aka Control
|
||||||
|
Loading…
Reference in New Issue
Block a user