Skip to content

Commit 4ba6070

Browse files
Merge pull request #79498 from aschwaighofer/pr_145092298
LoadableByAddress: Must be able to materialize undef operands
2 parents 9981bfa + 8120fa3 commit 4ba6070

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/IRGen/LoadableByAddress.cpp

Lines changed: 9 additions & 2 deletions
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);
@@ -1909,7 +1916,7 @@ static void allocateAndSetAll(StructLoweringState &pass,
19091916
SILType silType = value->getType();
19101917
if (pass.isLargeLoadableType(pass.F->getLoweredFunctionType(),
19111918
silType)) {
1912-
allocateAndSet(pass, allocator, value, user);
1919+
allocateAndSet(pass, allocator, value, user, operand);
19131920
}
19141921
}
19151922
}

0 commit comments

Comments
 (0)