[Distributed] IRGen: Fix loading of the witness tables

The witness table is an array of pointers - `void **`,
which means that the list of the witnesses has type of `void ***`.

Instead of using result of `emitAddressAtOffset` accessor
should set the correct type for the list, which is `void ***`
and emit bit a lot for each of the witness table slots.

Resolves: rdar://87568630
Resolves: rdar://88340451
This commit is contained in:
Pavel Yaskevich
2022-02-04 16:51:25 -08:00
parent ab85807f06
commit ab25d4e62a
4 changed files with 43 additions and 21 deletions

View File

@@ -510,15 +510,17 @@ void DistributedAccessor::emitLoadOfWitnessTables(llvm::Value *witnessTables,
IGF.Builder.emitBlock(contBB);
witnessTables = IGF.Builder.CreateBitCast(witnessTables, IGM.Int8PtrPtrTy);
witnessTables = IGF.Builder.CreateBitCast(witnessTables,
IGM.Int8PtrPtrTy->getPointerTo());
for (unsigned i = 0, n = expectedWitnessTables; i != n; ++i) {
auto offset = Size(i * IGM.getPointerSize());
auto alignment = IGM.getPointerAlignment();
auto witnessTableAddr = IGF.emitAddressAtOffset(
witnessTables, Offset(offset), IGM.Int8PtrTy, Alignment(alignment));
arguments.add(witnessTableAddr.getAddress());
witnessTables, Offset(offset), IGM.Int8PtrPtrTy, Alignment(alignment));
arguments.add(IGF.Builder.CreateLoad(witnessTableAddr));
}
}