diff options
| author | Andrew Trick <atrick@apple.com> | 2012-03-26 18:03:16 +0000 |
|---|---|---|
| committer | Andrew Trick <atrick@apple.com> | 2012-03-26 18:03:16 +0000 |
| commit | e51feea79c59428c25bd6e313ef0bee6f6568707 (patch) | |
| tree | a722f99f4d5f32266cb608413b36d6b5ad968b23 /llvm/lib | |
| parent | 9a05c8b479248fce66d2768beb80d87bf5135619 (diff) | |
| download | bcm5719-llvm-e51feea79c59428c25bd6e313ef0bee6f6568707.tar.gz bcm5719-llvm-e51feea79c59428c25bd6e313ef0bee6f6568707.zip | |
LSR cleanup: potential bug caught by PVS-Studio.
Thanks Andrey.
llvm-svn: 153451
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index c5996039a04..60b7e62729a 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -2497,13 +2497,14 @@ void LSRInstance::ChainInstruction(Instruction *UserInst, Instruction *IVOper, for (Value::use_iterator UseIter = IVOper->use_begin(), UseEnd = IVOper->use_end(); UseIter != UseEnd; ++UseIter) { Instruction *OtherUse = dyn_cast<Instruction>(*UseIter); + if (!OtherUse || OtherUse == UserInst) + continue; if (SE.isSCEVable(OtherUse->getType()) && !isa<SCEVUnknown>(SE.getSCEV(OtherUse)) && IU.isIVUserOrOperand(OtherUse)) { continue; } - if (OtherUse && OtherUse != UserInst) - NearUsers.insert(OtherUse); + NearUsers.insert(OtherUse); } // Since this user is part of the chain, it's no longer considered a use |

