Skip to content

Commit ed5b4cf

Browse files
committed
LoadableByAddress: Must be able to materialize undef operands
rdar://145092298
1 parent 8c8d573 commit ed5b4cf

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/IRGen/LoadableByAddress.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1883,7 +1883,14 @@ void LoadableStorageAllocation::replaceLoad(LoadInst *load) {
18831883

18841884
static void allocateAndSet(StructLoweringState &pass,
18851885
LoadableStorageAllocation &allocator,
1886-
SILValue operand, SILInstruction *user) {
1886+
SILValue operand, SILInstruction *user,
1887+
Operand &opd) {
1888+
if (isa<SILUndef>(operand)) {
1889+
auto alloc = allocate(pass, operand->getType());
1890+
opd.set(alloc);
1891+
return;
1892+
}
1893+
18871894
auto inst = operand->getDefiningInstruction();
18881895
if (!inst) {
18891896
allocateAndSetForArgument(pass, cast<SILArgument>(operand), user);

0 commit comments

Comments
 (0)