Skip to content

Commit d2495b6

Browse files
committed
[RGT] Exercise both paths through a test
BitcastToGEP had an opaque/typed pointer decision point, make sure it exercises both sides. Found by the Rotten Green Tests project.
1 parent ede248e commit d2495b6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

llvm/unittests/IR/ConstantsTest.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,9 +469,11 @@ TEST(ConstantsTest, BuildConstantDataVectors) {
469469
}
470470
}
471471

472-
TEST(ConstantsTest, BitcastToGEP) {
472+
void bitcastToGEPHelper(bool useOpaquePointers) {
473473
LLVMContext Context;
474474
std::unique_ptr<Module> M(new Module("MyModule", Context));
475+
if (useOpaquePointers)
476+
Context.enableOpaquePointers();
475477

476478
auto *i32 = Type::getInt32Ty(Context);
477479
auto *U = StructType::create(Context, "Unsized");
@@ -490,6 +492,11 @@ TEST(ConstantsTest, BitcastToGEP) {
490492
}
491493
}
492494

495+
TEST(ConstantsTest, BitcastToGEP) {
496+
bitcastToGEPHelper(true);
497+
bitcastToGEPHelper(false);
498+
}
499+
493500
bool foldFuncPtrAndConstToNull(LLVMContext &Context, Module *TheModule,
494501
uint64_t AndValue,
495502
MaybeAlign FunctionAlign = llvm::None) {

0 commit comments

Comments
 (0)