Revert "[FuzzMutate] Don't insert instructions after musttail call"

This reverts commit 6a23d2764467bd45c2e02828f6175a0b9f9a1005.

The newly added tests fail on the llvm-clang-x86_64-sie-win
buildbot. Not sure why a failure only occurs there, possibly
differen PRNG sequence?
This commit is contained in:
Nikita Popov 2022-03-16 17:28:17 +01:00
parent 4840e7505d
commit 0958450251
2 changed files with 0 additions and 40 deletions

View File

@ -116,16 +116,6 @@ void InjectorIRStrategy::mutate(BasicBlock &BB, RandomIRBuilder &IB) {
auto InstsBefore = makeArrayRef(Insts).slice(0, IP);
auto InstsAfter = makeArrayRef(Insts).slice(IP);
if (!InstsBefore.empty()) {
// Don't insert instructions after a musttail call.
Instruction *InstBefore = InstsBefore.back();
if (isa<BitCastInst>(InstBefore))
InstBefore = InstBefore->getPrevNode();
CallBase *CallBefore = dyn_cast_or_null<CallBase>(InstBefore);
if (CallBefore && CallBefore->isMustTailCall())
return;
}
// Choose a source, which will be used to constrain the operation selection.
SmallVector<Value *, 2> Srcs;
Srcs.push_back(IB.findOrCreateSource(BB, InstsBefore));

View File

@ -100,36 +100,6 @@ TEST(InjectorIRStrategyTest, EmptyModule) {
EXPECT_TRUE(!verifyModule(*M, &errs()));
}
TEST(InjectorIRStrategyTest, MustTailCall) {
// Test that we don't insert after a musttail call.
StringRef Source = ""
"define i32 @func() {\n"
"%v = musttail call i32 @func()\n"
"ret i32 %v\n"
"}\n";
auto Mutator = createInjectorMutator();
ASSERT_TRUE(Mutator);
IterateOnSource(Source, *Mutator);
}
TEST(InjectorIRStrategyTest, MustTailCallBitCast) {
// Test that we don't insert after a musttail call bitcast.
StringRef Source = ""
"declare i32* @func2()\n"
"define i8* @func() {\n"
"%v = musttail call i32* @func2()\n"
"%v2 = bitcast i32* %v to i8*\n"
"ret i8* %v2\n"
"}\n";
auto Mutator = createInjectorMutator();
ASSERT_TRUE(Mutator);
IterateOnSource(Source, *Mutator);
}
TEST(InstDeleterIRStrategyTest, EmptyFunction) {
// Test that we don't crash even if we can't remove from one of the functions.