From: Nick Lewycky Date: Wed, 3 Aug 2011 01:11:40 +0000 (+0000) Subject: Small cleanups: X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=dbd22550911ef20d09403d294090b480c03eeeca;p=oota-llvm.git 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! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136757 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/InstCombine/InstructionCombining.cpp b/lib/Transforms/InstCombine/InstructionCombining.cpp index 9c939039580..5bc7b0b8539 100644 --- a/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -1044,7 +1044,7 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) { -static bool IsOnlyNullComparedAndFreed(Value *V, SmallVector &Users, +static bool IsOnlyNullComparedAndFreed(Value *V, SmallVectorImpl &Users, int Depth = 0) { if (Depth == 8) return false; @@ -1069,8 +1069,7 @@ static bool IsOnlyNullComparedAndFreed(Value *V, SmallVector &Users, } } if (GetElementPtrInst *GEPI = dyn_cast(U)) { - if (GEPI->hasAllZeroIndices() && - IsOnlyNullComparedAndFreed(GEPI, Users, Depth+1)) { + if (IsOnlyNullComparedAndFreed(GEPI, Users, Depth+1)) { Users.push_back(GEPI); continue; }