diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2011-08-03 01:11:40 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2011-08-03 01:11:40 +0000 |
commit | d405b7e2aed88c5ba9d2ef7332e86f95baaeed78 (patch) | |
tree | 93be0d8d25e7ba61fc0802d7d8b7db5dcf377c7f /llvm/lib/Transforms/InstCombine/InstructionCombining.cpp | |
parent | 035ea32870e4c1cae21f18fe40f30b7e64e24e60 (diff) | |
download | bcm5719-llvm-d405b7e2aed88c5ba9d2ef7332e86f95baaeed78.tar.gz bcm5719-llvm-d405b7e2aed88c5ba9d2ef7332e86f95baaeed78.zip |
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
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstructionCombining.cpp')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstructionCombining.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp index 9c939039580..5bc7b0b8539 100644 --- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -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; } |