Skip to content

Commit 9775681

Browse files
Merge pull request #80907 from aschwaighofer/large_types_reg2mem_unchecked_bitwise_cast_propagate_6.2
[6.2] LargeTypesReg2Mem: Add unchecked_bitwise_cast to the projections we need to propagate largeness from destination to source operand
2 parents c8e9da9 + e3133f7 commit 9775681

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

lib/IRGen/LoadableByAddress.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -3574,6 +3574,7 @@ void LargeLoadableHeuristic::propagate(PostOrderFunctionInfo &po) {
35743574
for (auto *BB : po.getPostOrder()) {
35753575
for (auto &I : llvm::reverse(*BB)) {
35763576
switch (I.getKind()) {
3577+
case SILInstructionKind::UncheckedBitwiseCastInst:
35773578
case SILInstructionKind::TupleExtractInst:
35783579
case SILInstructionKind::StructExtractInst: {
35793580
auto &proj = cast<SingleValueInstruction>(I);

test/IRGen/loadable_by_address_reg2mem.sil

+20
Original file line numberDiff line numberDiff line change
@@ -425,3 +425,23 @@ bb0(%0 : $member_id_t):
425425
%13 = tuple ()
426426
return %13 : $()
427427
}
428+
429+
struct Z {
430+
var r: String
431+
var p: X
432+
}
433+
434+
// CHECK: sil @test17 : $@convention(thin) (@owned String) -> () {
435+
// CHECK: bb0(%0 : $String):
436+
// CHECK: [[T0:%.*]] = alloc_stack $String
437+
// CHECK: store %0 to [[T0]] : $*String
438+
// CHECK: [[T1:%.*]] = unchecked_addr_cast [[T0]] : $*String to $*Z
439+
// CHECK: release_value_addr [[T1]] : $*Z
440+
441+
sil @test17: $@convention(thin) (@owned String) -> () {
442+
bb0(%0 : $String):
443+
%1 = unchecked_bitwise_cast %0 : $String to $Z
444+
release_value %1 : $Z
445+
%13 = tuple ()
446+
return %13 : $()
447+
}

0 commit comments

Comments
 (0)