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 @@ -1514,6 +1514,47 @@ bb2:
1514
1514
return %r1 : $()
1515
1515
}
1516
1516
1517
+ struct Outer {
1518
+ var interactions: Inner
1519
+ }
1520
+
1521
+ public struct Inner {
1522
+ public let x: Int
1523
+ var storage: ContiguousArray<Double>
1524
+ }
1525
+
1526
+ sil @$get_array_from_inner : $@convention(method) (Inner) -> (ContiguousArray<Double>)
1527
+
1528
+ // Make sure we project load access path to matching store access path.
1529
+ // Otherwise the pass could crash.
1530
+ //
1531
+ // CHECK-LABEL: sil @project_load_path_before_splitting_crash :
1532
+ // CHECK: load
1533
+ // CHECK: bb1(%8 : $ContiguousArray<Double>):
1534
+ // CHECK: bb3:
1535
+ // CHECK: store
1536
+ // CHECK: } // end sil function 'project_load_path_before_splitting_crash'
1537
+ sil @project_load_path_before_splitting_crash : $@convention(thin) (@inout Outer) -> () {
1538
+ bb0(%0 : $*Outer):
1539
+ %1 = struct_element_addr %0, #Outer.interactions
1540
+ %2 = struct_element_addr %1, #Inner.storage
1541
+ br bb1
1542
+
1543
+ bb1:
1544
+ %4 = load %1
1545
+ %5 = function_ref @$get_array_from_inner : $@convention(method) (Inner) -> ContiguousArray<Double>
1546
+ %6 = apply %5(%4) : $@convention(method) (Inner) -> ContiguousArray<Double>
1547
+ store %6 to %2
1548
+ cond_br undef, bb2, bb3
1549
+
1550
+ bb2:
1551
+ br bb1
1552
+
1553
+ bb3:
1554
+ %10 = tuple ()
1555
+ return %10
1556
+ }
1557
+
1517
1558
// CHECK-LABEL: sil @dont_hoist_builtin_once_memory_conflict :
1518
1559
// CHECK: function_ref
1519
1560
// CHECK: br bb1
You can’t perform that action at this time.
0 commit comments