Avoid generating consecutive assignments to the same place#12
Avoid generating consecutive assignments to the same place#12saethlin wants to merge 1 commit intocbeuw:masterfrom
Conversation
|
I've tried to mitigating this issue previously, by reducing the weight of Places with high complexity1 when generating LHS: 70e2b0a. But I think I did it wrong and I eventually removed weight's dependency on complexity for LHS altogether. I'm more keen on trying something on this front again. For the issue in particular where a place is getting assigned with literals repeatedly, e.g. This is a sign that there isn't enough variables in the function for Rustlantis to find a non-literal Rvalue, since a literal operand is only generated as a last resort: rustlantis/generate/src/generation/mod.rs Lines 88 to 108 in 2be7c5a I made a separate PR to address this #13, by giving each function more variables to play with. I think it helps a bit, but a more data-flow-ish guided LHS selection is still desirable on top of this Footnotes
|
Currently, rustlantis tends to generate a lot of assignments to the same place within the same basic block. This is especially silly when the assignments to the same place occur next to each other. For example, this is the first basic block that comes out of
generatewith seed 0:In particular, I think this is wasteful:
So this PR is a very hacky way to prevent those. It works, but I'd appreciate advice on making it more elegant.