Skip to content

Commit b71cf4c

Browse files
committed
IRGen: Bitcast the storage address when emitting a tuple_pack_element_addr
1 parent a1aff7b commit b71cf4c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/IRGen/GenTuple.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,10 @@ Address irgen::projectTupleElementAddressByDynamicIndex(IRGenFunction &IGF,
565565
llvm::Value *offset = loadTupleOffsetFromMetadata(IGF, metadata, index);
566566
auto *gep =
567567
IGF.emitByteOffsetGEP(tuple.getAddress(), offset, IGF.IGM.OpaqueTy);
568-
return Address(gep, IGF.IGM.OpaqueTy, IGF.IGM.getPointerAlignment());
568+
auto elementAddress = Address(gep, IGF.IGM.OpaqueTy,
569+
IGF.IGM.getPointerAlignment());
570+
return IGF.Builder.CreateElementBitCast(elementAddress,
571+
IGF.IGM.getStorageType(elementType));
569572
}
570573

571574
Optional<Size> irgen::getFixedTupleElementOffset(IRGenModule &IGM,

0 commit comments

Comments
 (0)