dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.19k stars 1.57k forks source link

better propagation of boolean values through the program #48154

Closed mraleph closed 1 year ago

mraleph commented 2 years ago

Right now we have some support for propagating constant boolean values through the program:

However these passes have some unpredictable short comings and can surprise developers:

We should consider making these more predictable.

/cc @alexmarkov

alexmarkov commented 2 years ago

A few random thoughts:

@mraleph Do you have a real-world example where the lack of the constant propagation / folding in these cases causes suboptimal code and affects performance or code size?