aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar/IndVarSimplify.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2009-04-22 22:45:37 +0000
committerEvan Cheng <evan.cheng@apple.com>2009-04-22 22:45:37 +0000
commiteecb86859c07b226a32805394fae3f1218459ff8 (patch)
tree8cf2fb3ad9733301ea675367b367846a4f83d4ba /lib/Transforms/Scalar/IndVarSimplify.cpp
parent080d215b811948919ced416c86f64bce7e14cc42 (diff)
downloadexternal_llvm-eecb86859c07b226a32805394fae3f1218459ff8.zip
external_llvm-eecb86859c07b226a32805394fae3f1218459ff8.tar.gz
external_llvm-eecb86859c07b226a32805394fae3f1218459ff8.tar.bz2
Avoid deferencing use_begin() if value does not have a use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69836 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/IndVarSimplify.cpp')
-rw-r--r--lib/Transforms/Scalar/IndVarSimplify.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp
index 3e944d3..b1cde41 100644
--- a/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -806,6 +806,7 @@ bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) {
// (RHS doesn't have to be constant. There should be a better approach
// than bottom-up pattern matching for this...)
if (UInst && UInst->getOpcode()==Instruction::And &&
+ !UInst->use_empty() &&
allUsesAreSameTyped(Instruction::ZExt, UInst) &&
isa<ConstantInt>(UInst->getOperand(1))) {
uint64_t newBitSize = LargestType->getPrimitiveSizeInBits();