limit morphic to trivial analysis to avoid inplace mutation bugs

Surprisingly this actually increases perf of some benchmarks.
My guess is that it fixes bugs during looping and thus reduces work.
Specifically cFold and derive see minor gains ~1.5%; rBTreeCk sees a big gain ~4%.
NQueens is the only benchmark that sees a lost at ~2%.

False interpreter also see a 0-5% perf improvement depending on the exact input.
That said, the improvement was noisy.

ref #7367
This commit is contained in:
Brendan Hansknecht 2024-12-13 20:05:26 -08:00
parent a0de21d7d7
commit 1830b3a1f4
No known key found for this signature in database
GPG key ID: 0EA784685083E75B

View file

@ -358,7 +358,9 @@ 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.
OptLevel::Optimize | OptLevel::Size => morphic_lib::solve_trivial(program),
}
}
@ -1026,10 +1028,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) {