[PATCH] D139907: [FuzzMutate] RandomIRBuilder has more source and sink type now.
Peter Rong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 16 09:37:31 PDT 2023
Peter updated this revision to Diff 514034.
Peter added a comment.
Remove unit tests that checks for pointer type match, they are all opaque pointers now.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139907/new/
https://reviews.llvm.org/D139907
Files:
llvm/unittests/FuzzMutate/RandomIRBuilderTest.cpp
Index: llvm/unittests/FuzzMutate/RandomIRBuilderTest.cpp
===================================================================
--- llvm/unittests/FuzzMutate/RandomIRBuilderTest.cpp
+++ llvm/unittests/FuzzMutate/RandomIRBuilderTest.cpp
@@ -234,39 +234,6 @@
}
}
-TEST(RandomIRBuilderTest, FirstClassTypes) {
- // Check that we never insert new source as a load from non first class
- // or unsized type.
-
- LLVMContext Ctx;
- const char *SourceCode = "%Opaque = type opaque\n"
- "define void @test(i8* %ptr) {\n"
- "entry:\n"
- " %tmp = bitcast i8* %ptr to i32* (i32*)*\n"
- " %tmp1 = bitcast i8* %ptr to %Opaque*\n"
- " ret void\n"
- "}";
- auto M = parseAssembly(SourceCode, Ctx);
-
- std::array<Type *, 1> Types = {Type::getInt8Ty(Ctx)};
- RandomIRBuilder IB(Seed, Types);
-
- Function &F = *M->getFunction("test");
- BasicBlock &BB = *F.begin();
- // Non first class type
- Instruction *FuncPtr = &*BB.begin();
- // Unsized type
- Instruction *OpaquePtr = &*std::next(BB.begin());
-
- for (int i = 0; i < 10; ++i) {
- Value *V = IB.findOrCreateSource(BB, {FuncPtr, OpaquePtr});
- // To make sure we are allowed to load from a global variable
- if (LoadInst *LI = dyn_cast<LoadInst>(V)) {
- EXPECT_NE(LI->getOperand(0), FuncPtr);
- }
- }
-}
-
TEST(RandomIRBuilderTest, SwiftError) {
// Check that we never pick swifterror value as a source for operation
// other than load, store and call.
@@ -420,18 +387,18 @@
// Find existing global
std::unique_ptr<Module> M1 = parseAssembly(SourceCode, Ctx);
- IB.findOrCreateGlobalVariable(&*M1, {}, fuzzerop::onlyType(Types[0]));
+ IB.findOrCreateGlobalVariable(&*M1, {}, fuzzerop::onlyType(Types[1]));
ASSERT_FALSE(verifyModule(*M1, &errs()));
unsigned NumGV1 = M1->getNumNamedValues();
auto [GV1, DidCreate1] =
- IB.findOrCreateGlobalVariable(&*M1, {}, fuzzerop::onlyType(Types[0]));
+ IB.findOrCreateGlobalVariable(&*M1, {}, fuzzerop::onlyType(Types[1]));
ASSERT_FALSE(verifyModule(*M1, &errs()));
ASSERT_EQ(M1->getNumNamedValues(), NumGV1 + DidCreate1);
// Create new global
std::unique_ptr<Module> M2 = parseAssembly(SourceCode, Ctx);
auto [GV2, DidCreate2] =
- IB.findOrCreateGlobalVariable(&*M1, {}, fuzzerop::onlyType(Types[1]));
+ IB.findOrCreateGlobalVariable(&*M2, {}, fuzzerop::onlyType(Types[2]));
ASSERT_FALSE(verifyModule(*M2, &errs()));
ASSERT_TRUE(DidCreate2);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139907.514034.patch
Type: text/x-patch
Size: 2587 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230416/8b0fb5f8/attachment.bin>
More information about the llvm-commits
mailing list