Skip to content

Commit a322191

Browse files
authored
[CIR] Correct initialization of VoidPtrPtrTy (llvm#1336)
See issue llvm#1331 for more details. I'm not sure how to test this change; would it be enough that this does not cause any regressions?
1 parent 3017a00 commit a322191

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

clang/lib/CIR/CodeGen/CIRGenModule.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ CIRGenModule::CIRGenModule(mlir::MLIRContext &mlirContext,
128128

129129
// Initialize CIR pointer types cache.
130130
VoidPtrTy = cir::PointerType::get(&getMLIRContext(), VoidTy);
131+
VoidPtrPtrTy = cir::PointerType::get(&getMLIRContext(), VoidPtrTy);
131132

132133
FP16Ty = cir::FP16Type::get(&getMLIRContext());
133134
BFloat16Ty = cir::BF16Type::get(&getMLIRContext());
@@ -159,6 +160,7 @@ CIRGenModule::CIRGenModule(mlir::MLIRContext &mlirContext,
159160
UInt8PtrTy = builder.getPointerTo(UInt8Ty);
160161
UInt8PtrPtrTy = builder.getPointerTo(UInt8PtrTy);
161162
AllocaInt8PtrTy = UInt8PtrTy;
163+
AllocaVoidPtrTy = VoidPtrTy;
162164
// TODO: GlobalsInt8PtrTy
163165
// TODO: ConstGlobalsPtrTy
164166
CIRAllocaAddressSpace = getTargetCIRGenInfo().getCIRAllocaAddressSpace();

clang/lib/CIR/CodeGen/CIRGenTypeCache.h

+4-8
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,12 @@ struct CIRGenTypeCache {
6262
cir::PointerType UInt8PtrTy;
6363

6464
/// void** in address space 0
65-
union {
66-
cir::PointerType VoidPtrPtrTy;
67-
cir::PointerType UInt8PtrPtrTy;
68-
};
65+
cir::PointerType VoidPtrPtrTy;
66+
cir::PointerType UInt8PtrPtrTy;
6967

7068
/// void* in alloca address space
71-
union {
72-
cir::PointerType AllocaVoidPtrTy;
73-
cir::PointerType AllocaInt8PtrTy;
74-
};
69+
cir::PointerType AllocaVoidPtrTy;
70+
cir::PointerType AllocaInt8PtrTy;
7571

7672
/// void* in default globals address space
7773
// union {

0 commit comments

Comments
 (0)