[llvm] de918aa - [RandomIRBuilderTest] Convert to opaque pointers (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 5 02:09:20 PST 2023
Author: Nikita Popov
Date: 2023-01-05T11:09:03+01:00
New Revision: de918aa54f79a8b559303f0db583289a353d746b
URL: https://github.com/llvm/llvm-project/commit/de918aa54f79a8b559303f0db583289a353d746b
DIFF: https://github.com/llvm/llvm-project/commit/de918aa54f79a8b559303f0db583289a353d746b.diff
LOG: [RandomIRBuilderTest] Convert to opaque pointers (NFC)
The FirstClassTypes test is no longer relevant with opaque pointers,
or at least not in that form.
Added:
Modified:
llvm/unittests/FuzzMutate/RandomIRBuilderTest.cpp
Removed:
################################################################################
diff --git a/llvm/unittests/FuzzMutate/RandomIRBuilderTest.cpp b/llvm/unittests/FuzzMutate/RandomIRBuilderTest.cpp
index 95d4a383a0012..45ba42ee5f6fc 100644
--- a/llvm/unittests/FuzzMutate/RandomIRBuilderTest.cpp
+++ b/llvm/unittests/FuzzMutate/RandomIRBuilderTest.cpp
@@ -91,7 +91,7 @@ TEST(RandomIRBuilderTest, InsertValueIndexes) {
const char *Source = "%T = type {i8, i32, i64}\n"
"define void @test() {\n"
" %A = alloca %T\n"
- " %L = load %T, %T* %A"
+ " %L = load %T, ptr %A"
" ret void\n"
"}";
auto M = parseAssembly(Source, Ctx);
@@ -169,7 +169,7 @@ TEST(RandomIRBuilderTest, InsertValueArray) {
LLVMContext Ctx;
const char *SourceCode = "define void @test() {\n"
" %A = alloca [8 x i32]\n"
- " %L = load [8 x i32], [8 x i32]* %A"
+ " %L = load [8 x i32], ptr %A"
" ret void\n"
"}";
auto M = parseAssembly(SourceCode, Ctx);
@@ -203,17 +203,17 @@ TEST(RandomIRBuilderTest, Invokes) {
LLVMContext Ctx;
const char *SourceCode =
- "declare i32* @f()"
+ "declare ptr @f()"
"declare i32 @personality_function()"
- "define i32* @test() personality i32 ()* @personality_function {\n"
+ "define ptr @test() personality ptr @personality_function {\n"
"entry:\n"
- " %val = invoke i32* @f()\n"
+ " %val = invoke ptr @f()\n"
" to label %normal unwind label %exceptional\n"
"normal:\n"
- " ret i32* %val\n"
+ " ret ptr %val\n"
"exceptional:\n"
" %landing_pad4 = landingpad token cleanup\n"
- " ret i32* undef\n"
+ " ret ptr undef\n"
"}";
auto M = parseAssembly(SourceCode, Ctx);
@@ -233,46 +233,16 @@ TEST(RandomIRBuilderTest, Invokes) {
}
}
-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::vector<Type *> 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});
- ASSERT_FALSE(isa<LoadInst>(V));
- }
-}
-
TEST(RandomIRBuilderTest, SwiftError) {
// Check that we never pick swifterror value as a source for operation
// other than load, store and call.
LLVMContext Ctx;
- const char *SourceCode = "declare void @use(i8** swifterror %err)"
+ const char *SourceCode = "declare void @use(ptr swifterror %err)"
"define void @test() {\n"
"entry:\n"
- " %err = alloca swifterror i8*, align 8\n"
- " call void @use(i8** swifterror %err)\n"
+ " %err = alloca swifterror ptr, align 8\n"
+ " call void @use(ptr swifterror %err)\n"
" ret void\n"
"}";
auto M = parseAssembly(SourceCode, Ctx);
More information about the llvm-commits
mailing list