File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed
lib/SILOptimizer/LoopTransforms Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -1148,7 +1148,7 @@ SingleValueInstruction *LoopTreeOptimization::splitLoad(
1148
1148
}
1149
1149
elements.push_back (elementVal);
1150
1150
}
1151
- return builder.createTuple (loc, elements);
1151
+ return builder.createTuple (loc, loadTy. getObjectType (), elements);
1152
1152
}
1153
1153
auto structTy = loadTy.getStructOrBoundGenericStruct ();
1154
1154
assert (structTy && " tuple and struct elements are checked earlier" );
Original file line number Diff line number Diff line change @@ -23,6 +23,10 @@ struct S {
23
23
var s: String
24
24
}
25
25
26
+ struct Pair {
27
+ var t: (a: Int, b: Int)
28
+ }
29
+
26
30
// globalArray
27
31
sil_global @globalArray : $Storage
28
32
@@ -1704,3 +1708,30 @@ bb4(%14 : @reborrow $S):
1704
1708
return %r
1705
1709
}
1706
1710
1711
+ // Just check that LICM doesn't produce invalid SIL because of a tuple type mismatch.
1712
+ // CHECK-LABEL: sil [ossa] @split_load_of_labeld_tuples :
1713
+ // CHECK-LABEL: } // end sil function 'split_load_of_labeld_tuples'
1714
+ sil [ossa] @split_load_of_labeld_tuples : $@convention(thin) (@inout Pair, Int) -> () {
1715
+ bb0(%0 : $*Pair, %1 : $Int):
1716
+ br bb1
1717
+
1718
+ bb1:
1719
+ cond_br undef, bb3, bb2
1720
+
1721
+ bb2:
1722
+ %4 = load [trivial] %0
1723
+ %5 = struct_element_addr %0, #Pair.t
1724
+ %6 = tuple_element_addr %5, 0
1725
+ %7 = alloc_stack $Int
1726
+ store %1 to [trivial] %7
1727
+ %9 = load [trivial] %7
1728
+ store %9 to [trivial] %6
1729
+ dealloc_stack %7
1730
+ br bb1
1731
+
1732
+ bb3:
1733
+ %13 = tuple ()
1734
+ return %13
1735
+ }
1736
+
1737
+
You can’t perform that action at this time.
0 commit comments