Skip to content

[6.2] LargeTypesReg2Mem: Add unchecked_bitwise_cast to the projections we need to propagate largeness from destination to source operand #80907

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/IRGen/LoadableByAddress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3574,6 +3574,7 @@ void LargeLoadableHeuristic::propagate(PostOrderFunctionInfo &po) {
for (auto *BB : po.getPostOrder()) {
for (auto &I : llvm::reverse(*BB)) {
switch (I.getKind()) {
case SILInstructionKind::UncheckedBitwiseCastInst:
case SILInstructionKind::TupleExtractInst:
case SILInstructionKind::StructExtractInst: {
auto &proj = cast<SingleValueInstruction>(I);
Expand Down
20 changes: 20 additions & 0 deletions test/IRGen/loadable_by_address_reg2mem.sil
Original file line number Diff line number Diff line change
Expand Up @@ -425,3 +425,23 @@ bb0(%0 : $member_id_t):
%13 = tuple ()
return %13 : $()
}

struct Z {
var r: String
var p: X
}

// CHECK: sil @test17 : $@convention(thin) (@owned String) -> () {
// CHECK: bb0(%0 : $String):
// CHECK: [[T0:%.*]] = alloc_stack $String
// CHECK: store %0 to [[T0]] : $*String
// CHECK: [[T1:%.*]] = unchecked_addr_cast [[T0]] : $*String to $*Z
// CHECK: release_value_addr [[T1]] : $*Z

sil @test17: $@convention(thin) (@owned String) -> () {
bb0(%0 : $String):
%1 = unchecked_bitwise_cast %0 : $String to $Z
release_value %1 : $Z
%13 = tuple ()
return %13 : $()
}