aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2012-03-26 18:03:16 +0000
committerAndrew Trick <atrick@apple.com>2012-03-26 18:03:16 +0000
commit81748bc32092c75c61bb7cb34bfb5a616924e535 (patch)
tree4c2a9a3eddec3369d36ebb4bcba088063d41b4a6 /lib/Transforms
parentf64282145ea517061471072df974c110b132ade9 (diff)
downloadexternal_llvm-81748bc32092c75c61bb7cb34bfb5a616924e535.zip
external_llvm-81748bc32092c75c61bb7cb34bfb5a616924e535.tar.gz
external_llvm-81748bc32092c75c61bb7cb34bfb5a616924e535.tar.bz2
LSR cleanup: potential bug caught by PVS-Studio.
Thanks Andrey. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153451 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/LoopStrengthReduce.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index c599603..60b7e62 100644
--- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/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