diff options
author | Igor Laevsky <igmyrj@gmail.com> | 2018-01-25 09:22:18 +0000 |
---|---|---|
committer | Igor Laevsky <igmyrj@gmail.com> | 2018-01-25 09:22:18 +0000 |
commit | 7a43f26dc8416eb09e660ea29ccfc943d1e08557 (patch) | |
tree | c4f6b13a73e698c99176770cd093630a662055fd /llvm/lib/FuzzMutate | |
parent | 48b486568353e90ebc92ecc57436c0c609be7004 (diff) | |
download | bcm5719-llvm-7a43f26dc8416eb09e660ea29ccfc943d1e08557.tar.gz bcm5719-llvm-7a43f26dc8416eb09e660ea29ccfc943d1e08557.zip |
[FuzzMutate] Inst deleter doesn't work with PhiNodes
Differential Revision: https://reviews.llvm.org/D42412
llvm-svn: 323409
Diffstat (limited to 'llvm/lib/FuzzMutate')
-rw-r--r-- | llvm/lib/FuzzMutate/IRMutator.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/llvm/lib/FuzzMutate/IRMutator.cpp b/llvm/lib/FuzzMutate/IRMutator.cpp index 00b558ac4dc..2dc7dfb880a 100644 --- a/llvm/lib/FuzzMutate/IRMutator.cpp +++ b/llvm/lib/FuzzMutate/IRMutator.cpp @@ -152,10 +152,14 @@ uint64_t InstDeleterIRStrategy::getWeight(size_t CurrentSize, size_t MaxSize, void InstDeleterIRStrategy::mutate(Function &F, RandomIRBuilder &IB) { auto RS = makeSampler<Instruction *>(IB.Rand); - // Avoid terminators so we don't have to worry about keeping the CFG coherent. - for (Instruction &Inst : instructions(F)) - if (!Inst.isTerminator()) - RS.sample(&Inst, /*Weight=*/1); + for (Instruction &Inst : instructions(F)) { + // TODO: We can't handle these instructions. + if (Inst.isTerminator() || Inst.isEHPad() || + Inst.isSwiftError() || isa<PHINode>(Inst)) + continue; + + RS.sample(&Inst, /*Weight=*/1); + } if (RS.isEmpty()) return; @@ -191,4 +195,5 @@ void InstDeleterIRStrategy::mutate(Instruction &Inst, RandomIRBuilder &IB) { RS.sample(IB.newSource(*BB, InstsBefore, {}, Pred), /*Weight=*/1); Inst.replaceAllUsesWith(RS.getSelection()); + Inst.eraseFromParent(); } |