Skip to content

Commit 8457ba3

Browse files
committed
Add emitLoad/emitStore to OpaqueValue type lowering.
1 parent 8a7e955 commit 8457ba3

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

lib/SIL/IR/TypeLowering.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,10 +1605,6 @@ namespace {
16051605
};
16061606

16071607
/// Lower address only types as opaque values.
1608-
///
1609-
/// Opaque values behave like loadable leaf types in SIL.
1610-
///
1611-
/// FIXME: When you remove an unreachable, just delete the method.
16121608
class OpaqueValueTypeLowering : public LeafLoadableTypeLowering {
16131609
public:
16141610
OpaqueValueTypeLowering(SILType type, RecursiveProperties properties,
@@ -1622,6 +1618,20 @@ namespace {
16221618
llvm_unreachable("copy into");
16231619
}
16241620

1621+
// OpaqueValue store cannot be decoupled from a destroy because it is not
1622+
// bitwise-movable.
1623+
void emitStore(SILBuilder &B, SILLocation loc, SILValue value,
1624+
SILValue addr, StoreOwnershipQualifier qual) const override {
1625+
B.createStore(loc, value, addr, qual);
1626+
}
1627+
1628+
// OpaqueValue load cannot be decoupled from a copy because it is not
1629+
// bitwise-movable.
1630+
SILValue emitLoad(SILBuilder &B, SILLocation loc, SILValue addr,
1631+
LoadOwnershipQualifier qual) const override {
1632+
return B.createLoad(loc, addr, qual);
1633+
}
1634+
16251635
// --- Same as LeafLoadableTypeLowering.
16261636

16271637
SILValue emitLoweredCopyValue(SILBuilder &B, SILLocation loc,

0 commit comments

Comments
 (0)