summaryrefslogtreecommitdiffstats
path: root/llvm/lib/FuzzMutate
diff options
context:
space:
mode:
authorIgor Laevsky <igmyrj@gmail.com>2017-11-30 15:07:38 +0000
committerIgor Laevsky <igmyrj@gmail.com>2017-11-30 15:07:38 +0000
commit444afc82c0558eaef96b0402d00490f5b9ad84cf (patch)
treee7e08f986d03ca270d04f46d033e910ef500c439 /llvm/lib/FuzzMutate
parent7fb231202c405f88eb628e75b8a68e693ff6b770 (diff)
downloadbcm5719-llvm-444afc82c0558eaef96b0402d00490f5b9ad84cf.tar.gz
bcm5719-llvm-444afc82c0558eaef96b0402d00490f5b9ad84cf.zip
[FuzzMutate] Don't crash when we can't remove instruction from empty function
Differential Revision: https://reviews.llvm.org/D40393 llvm-svn: 319438
Diffstat (limited to 'llvm/lib/FuzzMutate')
-rw-r--r--llvm/lib/FuzzMutate/IRMutator.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/FuzzMutate/IRMutator.cpp b/llvm/lib/FuzzMutate/IRMutator.cpp
index 6545446a984..59f94716caa 100644
--- a/llvm/lib/FuzzMutate/IRMutator.cpp
+++ b/llvm/lib/FuzzMutate/IRMutator.cpp
@@ -147,7 +147,9 @@ void InstDeleterIRStrategy::mutate(Function &F, RandomIRBuilder &IB) {
for (Instruction &Inst : instructions(F))
if (!Inst.isTerminator())
RS.sample(&Inst, /*Weight=*/1);
- assert(!RS.isEmpty() && "No instructions to delete");
+ if (RS.isEmpty())
+ return;
+
// Delete the instruction.
mutate(*RS.getSelection(), IB);
// Clean up any dead code that's left over after removing the instruction.
OpenPOWER on IntegriCloud