diff --git a/llvm/lib/FuzzMutate/IRMutator.cpp b/llvm/lib/FuzzMutate/IRMutator.cpp --- a/llvm/lib/FuzzMutate/IRMutator.cpp +++ b/llvm/lib/FuzzMutate/IRMutator.cpp @@ -566,7 +566,8 @@ } void ShuffleBlockStrategy::mutate(BasicBlock &BB, RandomIRBuilder &IB) { - + if (BB.isEHPad()) + return; SmallPtrSet AliveInsts; for (auto &I : make_early_inc_range(make_range( BB.getFirstInsertionPt(), BB.getTerminator()->getIterator()))) { diff --git a/llvm/unittests/FuzzMutate/StrategiesTest.cpp b/llvm/unittests/FuzzMutate/StrategiesTest.cpp --- a/llvm/unittests/FuzzMutate/StrategiesTest.cpp +++ b/llvm/unittests/FuzzMutate/StrategiesTest.cpp @@ -640,4 +640,23 @@ }"; VerifyBlockShuffle(Source); } + +TEST(ShuffleBlockStrategy, ShuffleEHPad) { + StringRef Source = "\n\ + define void @f(i32 %x) personality ptr @__CxxFrameHandler3 { \n\ + entry: \n\ + invoke void @g() to label %try.cont unwind label %catch.dispatch \n\ + catch.dispatch: \n\ + %0 = catchswitch within none [label %catch] unwind to caller \n\ + catch: \n\ + %1 = catchpad within %0 [ptr null, i32 64, ptr null] \n\ + catchret from %1 to label %try.cont \n\ + try.cont: \n\ + ret void \n\ + } \n\ + declare void @g() \n\ + declare i32 @__CxxFrameHandler3(...) \n\ + "; + VerifyBlockShuffle(Source); +} } // namespace