summaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar
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
commit1abe64663e0865cf9bdc23de734df49acea2b0d4 (patch)
tree8cf2fb3ad9733301ea675367b367846a4f83d4ba /lib/Transforms/Scalar
parent5654613a013b94a92f9ed65e1a2f34e0a8d9cfdf (diff)
downloadexternal_llvm-1abe64663e0865cf9bdc23de734df49acea2b0d4.zip
external_llvm-1abe64663e0865cf9bdc23de734df49acea2b0d4.tar.gz
external_llvm-1abe64663e0865cf9bdc23de734df49acea2b0d4.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')
-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();