Skip to content

Commit

Permalink
Revert "[FuzzMutate] Don't insert instructions after musttail call"
Browse files Browse the repository at this point in the history
This reverts commit 6a23d27.

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?
  • Loading branch information
nikic committed Mar 16, 2022
1 parent 4840e75 commit 0958450
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 40 deletions.
10 changes: 0 additions & 10 deletions llvm/lib/FuzzMutate/IRMutator.cpp
Expand Up @@ -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));
Expand Down
30 changes: 0 additions & 30 deletions llvm/unittests/FuzzMutate/StrategiesTest.cpp
Expand Up @@ -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.

Expand Down

0 comments on commit 0958450

Please sign in to comment.