Skip to content

Commit

Permalink
Merge pull request roc-lang#7370 from roc-lang/disable-morphic
Browse files Browse the repository at this point in the history
limit morphic to trivial analysis to avoid inplace mutation bugs
  • Loading branch information
bhansconnect authored Dec 16, 2024
2 parents edd7c65 + 9fd65ff commit 32e0ea3
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions crates/compiler/alias_analysis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,16 @@ where

match opt_level {
OptLevel::Development | OptLevel::Normal => morphic_lib::solve_trivial(program),
OptLevel::Optimize | OptLevel::Size => morphic_lib::solve(program),
// TODO(#7367): Change this back to `morphic_lib::solve`.
// For now, using solve_trivial to avoid bug with loops.
// Note: when disabling this, there was not much of a change in performance.
// Notably, NQueens was about 5% slower. False interpreter was 0-5% faster (depending on input).
// cFold and derive saw minor gains ~1.5%. rBTreeCk saw a big gain of ~4%.
// This feels wrong, morphic should not really be able to slow down code.
// Likely, noise or the bug and wrong inplace mutation lead to these perf changes.
// When re-enabling this, we should analysis the perf and inplace mutations of a few apps.
// It might be the case that our current benchmarks just aren't affected by morphic much.
OptLevel::Optimize | OptLevel::Size => morphic_lib::solve_trivial(program),
}
}

Expand Down Expand Up @@ -1026,10 +1035,10 @@ fn lowlevel_spec<'a>(
let _unit1 = builder.add_touch(block, cell)?;
let _unit2 = builder.add_update(block, update_mode_var, cell)?;

builder.add_bag_insert(block, bag, to_insert)?;
let new_bag = builder.add_bag_insert(block, bag, to_insert)?;

let old_value = builder.add_bag_get(block, bag)?;
let new_list = with_new_heap_cell(builder, block, bag)?;
let old_value = builder.add_bag_get(block, new_bag)?;
let new_list = with_new_heap_cell(builder, block, new_bag)?;

// depending on the types, the list or value will come first in the struct
let fields = match interner.get_repr(layout) {
Expand Down

0 comments on commit 32e0ea3

Please sign in to comment.