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; }