Small cleanups:

- use SmallVectorImpl& for the function argument.
  - ignore the operands on the GEP, even if they aren't constant! Much as we
    pretend the malloc succeeds, we pretend that malloc + whatever-you-GEP'd-by
    is not null. It's magic!

llvm-svn: 136757
This commit is contained in:
Nick Lewycky 2011-08-03 01:11:40 +00:00
parent 035ea32870
commit d405b7e2ae
1 changed files with 2 additions and 3 deletions

View File

@ -1044,7 +1044,7 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) {
static bool IsOnlyNullComparedAndFreed(Value *V, SmallVector<WeakVH, 64> &Users,
static bool IsOnlyNullComparedAndFreed(Value *V, SmallVectorImpl<WeakVH> &Users,
int Depth = 0) {
if (Depth == 8)
return false;
@ -1069,8 +1069,7 @@ static bool IsOnlyNullComparedAndFreed(Value *V, SmallVector<WeakVH, 64> &Users,
}
}
if (GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(U)) {
if (GEPI->hasAllZeroIndices() &&
IsOnlyNullComparedAndFreed(GEPI, Users, Depth+1)) {
if (IsOnlyNullComparedAndFreed(GEPI, Users, Depth+1)) {
Users.push_back(GEPI);
continue;
}