[llvm] r319444 - [FuzzMutate] Bailout from injecting into empty basic blocks.
Igor Laevsky via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 30 07:41:58 PST 2017
Author: igor.laevsky
Date: Thu Nov 30 07:41:58 2017
New Revision: 319444
URL: http://llvm.org/viewvc/llvm-project?rev=319444&view=rev
Log:
[FuzzMutate] Bailout from injecting into empty basic blocks.
In rare cases we can receive request to inject into completelly empty basic block. In the normal case
all basic blocks contain at least terminator instruction, but it is possible that the only instruction is
catchpad instruction which is not part of the instruction iterator. This case seems rare enough to not care
about it.
Submiting without review, since it seems almost NFC. I couldn't come up with any reasonable way to test this.
Modified:
llvm/trunk/lib/FuzzMutate/IRMutator.cpp
Modified: llvm/trunk/lib/FuzzMutate/IRMutator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/FuzzMutate/IRMutator.cpp?rev=319444&r1=319443&r2=319444&view=diff
==============================================================================
--- llvm/trunk/lib/FuzzMutate/IRMutator.cpp (original)
+++ llvm/trunk/lib/FuzzMutate/IRMutator.cpp Thu Nov 30 07:41:58 2017
@@ -105,6 +105,8 @@ void InjectorIRStrategy::mutate(BasicBlo
SmallVector<Instruction *, 32> Insts;
for (auto I = BB.getFirstInsertionPt(), E = BB.end(); I != E; ++I)
Insts.push_back(&*I);
+ if (Insts.size() < 1)
+ return;
// Choose an insertion point for our new instruction.
size_t IP = uniform<size_t>(IB.Rand, 0, Insts.size() - 1);
More information about the llvm-commits
mailing list