diff --git a/llvm/unittests/FuzzMutate/RandomIRBuilderTest.cpp b/llvm/unittests/FuzzMutate/RandomIRBuilderTest.cpp --- a/llvm/unittests/FuzzMutate/RandomIRBuilderTest.cpp +++ b/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 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(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 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 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); }