summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar
diff options
context:
space:
mode:
authorJames Molloy <james.molloy@arm.com>2015-02-16 17:01:52 +0000
committerJames Molloy <james.molloy@arm.com>2015-02-16 17:01:52 +0000
commit4c7deb2259cc12fc7f70f71eec76bebc8dfaf727 (patch)
tree78b296497fcdc60f5cbc9130aa4e9ec03e7a1a10 /llvm/lib/Transforms/Scalar
parent3a002255e3439f6b02d789f5ccc1a6dab67a6c8c (diff)
downloadbcm5719-llvm-4c7deb2259cc12fc7f70f71eec76bebc8dfaf727.tar.gz
bcm5719-llvm-4c7deb2259cc12fc7f70f71eec76bebc8dfaf727.zip
[LoopReroll] Don't crash on dead code
If a PHI has no users, don't crash; bail gracefully. This shouldn't happen often, but we can make no guarantees that previous passes didn't leave dead code around. llvm-svn: 229405
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopRerollPass.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopRerollPass.cpp b/llvm/lib/Transforms/Scalar/LoopRerollPass.cpp
index 852f3ed9d51..704299f3041 100644
--- a/llvm/lib/Transforms/Scalar/LoopRerollPass.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopRerollPass.cpp
@@ -511,6 +511,8 @@ void LoopReroll::SimpleLoopReduction::add(Loop *L) {
// (including the PHI), except for the last value (which is used by the PHI
// and also outside the loop).
Instruction *C = Instructions.front();
+ if (C->user_empty())
+ return;
do {
C = cast<Instruction>(*C->user_begin());
OpenPOWER on IntegriCloud