File tree Expand file tree Collapse file tree 2 files changed +43
-1
lines changed
SwiftCompilerSources/Sources/Optimizer/FunctionPasses Expand file tree Collapse file tree 2 files changed +43
-1
lines changed Original file line number Diff line number Diff line change @@ -587,7 +587,8 @@ private extension AnalyzedInstructions {
587
587
continue
588
588
}
589
589
590
- guard let splitLoads = loadInst. trySplit ( alongPath: accessPath. projectionPath, context) else {
590
+ guard let projectionPath = loadInst. operand. value. accessPath. getProjection ( to: accessPath) ,
591
+ let splitLoads = loadInst. trySplit ( alongPath: projectionPath, context) else {
591
592
newLoads. push ( loadInst)
592
593
return false
593
594
}
Original file line number Diff line number Diff line change @@ -1549,6 +1549,47 @@ bb2:
1549
1549
return %r1 : $()
1550
1550
}
1551
1551
1552
+ struct Outer {
1553
+ var interactions: Inner
1554
+ }
1555
+
1556
+ public struct Inner {
1557
+ public let x: Int
1558
+ var storage: ContiguousArray<Double>
1559
+ }
1560
+
1561
+ sil @$get_array_from_inner : $@convention(method) (Inner) -> (ContiguousArray<Double>)
1562
+
1563
+ // Make sure we project load access path to matching store access path.
1564
+ // Otherwise the pass could crash.
1565
+ //
1566
+ // CHECK-LABEL: sil @project_load_path_before_splitting_crash :
1567
+ // CHECK: load
1568
+ // CHECK: bb1(%8 : $ContiguousArray<Double>):
1569
+ // CHECK: bb3:
1570
+ // CHECK: store
1571
+ // CHECK: } // end sil function 'project_load_path_before_splitting_crash'
1572
+ sil @project_load_path_before_splitting_crash : $@convention(thin) (@inout Outer) -> () {
1573
+ bb0(%0 : $*Outer):
1574
+ %1 = struct_element_addr %0, #Outer.interactions
1575
+ %2 = struct_element_addr %1, #Inner.storage
1576
+ br bb1
1577
+
1578
+ bb1:
1579
+ %4 = load %1
1580
+ %5 = function_ref @$get_array_from_inner : $@convention(method) (Inner) -> ContiguousArray<Double>
1581
+ %6 = apply %5(%4) : $@convention(method) (Inner) -> ContiguousArray<Double>
1582
+ store %6 to %2
1583
+ cond_br undef, bb2, bb3
1584
+
1585
+ bb2:
1586
+ br bb1
1587
+
1588
+ bb3:
1589
+ %10 = tuple ()
1590
+ return %10
1591
+ }
1592
+
1552
1593
// CHECK-LABEL: sil @dont_hoist_builtin_once_memory_conflict :
1553
1594
// CHECK: function_ref
1554
1595
// CHECK: br bb1
You can’t perform that action at this time.
0 commit comments