Skip to content

Commit 0958450

Browse files
committed
Revert "[FuzzMutate] Don't insert instructions after musttail call"
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?
1 parent 4840e75 commit 0958450

File tree

2 files changed

+0
-40
lines changed

2 files changed

+0
-40
lines changed

llvm/lib/FuzzMutate/IRMutator.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -116,16 +116,6 @@ void InjectorIRStrategy::mutate(BasicBlock &BB, RandomIRBuilder &IB) {
116116
auto InstsBefore = makeArrayRef(Insts).slice(0, IP);
117117
auto InstsAfter = makeArrayRef(Insts).slice(IP);
118118

119-
if (!InstsBefore.empty()) {
120-
// Don't insert instructions after a musttail call.
121-
Instruction *InstBefore = InstsBefore.back();
122-
if (isa<BitCastInst>(InstBefore))
123-
InstBefore = InstBefore->getPrevNode();
124-
CallBase *CallBefore = dyn_cast_or_null<CallBase>(InstBefore);
125-
if (CallBefore && CallBefore->isMustTailCall())
126-
return;
127-
}
128-
129119
// Choose a source, which will be used to constrain the operation selection.
130120
SmallVector<Value *, 2> Srcs;
131121
Srcs.push_back(IB.findOrCreateSource(BB, InstsBefore));

llvm/unittests/FuzzMutate/StrategiesTest.cpp

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -100,36 +100,6 @@ TEST(InjectorIRStrategyTest, EmptyModule) {
100100
EXPECT_TRUE(!verifyModule(*M, &errs()));
101101
}
102102

103-
TEST(InjectorIRStrategyTest, MustTailCall) {
104-
// Test that we don't insert after a musttail call.
105-
StringRef Source = ""
106-
"define i32 @func() {\n"
107-
"%v = musttail call i32 @func()\n"
108-
"ret i32 %v\n"
109-
"}\n";
110-
111-
auto Mutator = createInjectorMutator();
112-
ASSERT_TRUE(Mutator);
113-
114-
IterateOnSource(Source, *Mutator);
115-
}
116-
117-
TEST(InjectorIRStrategyTest, MustTailCallBitCast) {
118-
// Test that we don't insert after a musttail call bitcast.
119-
StringRef Source = ""
120-
"declare i32* @func2()\n"
121-
"define i8* @func() {\n"
122-
"%v = musttail call i32* @func2()\n"
123-
"%v2 = bitcast i32* %v to i8*\n"
124-
"ret i8* %v2\n"
125-
"}\n";
126-
127-
auto Mutator = createInjectorMutator();
128-
ASSERT_TRUE(Mutator);
129-
130-
IterateOnSource(Source, *Mutator);
131-
}
132-
133103
TEST(InstDeleterIRStrategyTest, EmptyFunction) {
134104
// Test that we don't crash even if we can't remove from one of the functions.
135105

0 commit comments

Comments
 (0)