Skip to content
Snippets Groups Projects
Commit 8a9d8790 authored by Aaron Councilman's avatar Aaron Councilman
Browse files

Merge branch 'main' into sroa

parents b44f450c 43b90e94
No related branches found
No related tags found
1 merge request!57Intraprocedural SROA
Pipeline #200281 passed
This commit is part of merge request !57. Comments created here will be created in the context of that merge request.
...@@ -634,7 +634,17 @@ pub fn repair_plan(plan: &mut Plan, new_function: &Function, edits: &[Edit]) { ...@@ -634,7 +634,17 @@ pub fn repair_plan(plan: &mut Plan, new_function: &Function, edits: &[Edit]) {
new_partitions[data_id.idx()] = new_partitions[bbs[data_id.idx()].idx()]; new_partitions[data_id.idx()] = new_partitions[bbs[data_id.idx()].idx()];
} }
// Step 6: wrap everything up. // Step 6: create a solitary gravestone partition. This will get removed
// when gravestone nodes are removed.
let gravestone_partition = PartitionID::new(plan.num_partitions);
plan.num_partitions += 1;
for (idx, node) in new_function.nodes.iter().enumerate() {
if idx > 0 && node.is_start() {
new_partitions[idx] = Some(gravestone_partition);
}
}
// Step 7: wrap everything up.
plan.partitions = new_partitions.into_iter().map(|id| id.unwrap()).collect(); plan.partitions = new_partitions.into_iter().map(|id| id.unwrap()).collect();
plan.partition_devices plan.partition_devices
.resize(plan.num_partitions, Device::CPU); .resize(plan.num_partitions, Device::CPU);
......
...@@ -197,7 +197,14 @@ fn inline_func( ...@@ -197,7 +197,14 @@ fn inline_func(
// Stich the control use of the original call node's region with // Stich the control use of the original call node's region with
// the predecessor control of the inlined function's return. // the predecessor control of the inlined function's return.
edit = edit.replace_all_uses(control, old_id_to_new_id(called_return_pred))?; edit = edit.replace_all_uses(
control,
if called_return_pred == NodeID::new(0) {
call_pred
} else {
old_id_to_new_id(called_return_pred)
},
)?;
// Stitch uses of parameter nodes in the inlined function to the IDs // Stitch uses of parameter nodes in the inlined function to the IDs
// of arguments provided to the call node. // of arguments provided to the call node.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment