mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-09 19:03:27 +00:00
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:
parent
4840e7505d
commit
0958450251
@ -116,16 +116,6 @@ void InjectorIRStrategy::mutate(BasicBlock &BB, RandomIRBuilder &IB) {
|
|||||||
auto InstsBefore = makeArrayRef(Insts).slice(0, IP);
|
auto InstsBefore = makeArrayRef(Insts).slice(0, IP);
|
||||||
auto InstsAfter = makeArrayRef(Insts).slice(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.
|
// Choose a source, which will be used to constrain the operation selection.
|
||||||
SmallVector<Value *, 2> Srcs;
|
SmallVector<Value *, 2> Srcs;
|
||||||
Srcs.push_back(IB.findOrCreateSource(BB, InstsBefore));
|
Srcs.push_back(IB.findOrCreateSource(BB, InstsBefore));
|
||||||
|
@ -100,36 +100,6 @@ TEST(InjectorIRStrategyTest, EmptyModule) {
|
|||||||
EXPECT_TRUE(!verifyModule(*M, &errs()));
|
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(InstDeleterIRStrategyTest, EmptyFunction) {
|
||||||
// Test that we don't crash even if we can't remove from one of the functions.
|
// Test that we don't crash even if we can't remove from one of the functions.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user