Add IfElseSwap option

This enables an option that was being done unconditionally: to swap the `if` and `else` branches if the condition is shorter when negated.

Enabled by default.
This commit is contained in:
Sei Lisa 2022-10-31 20:08:26 +01:00
parent e62b5ffcb6
commit 08c429f22b
8 changed files with 44 additions and 17 deletions

View file

@ -68,6 +68,7 @@ class optimizer(foldconst, renamer, deadcode, lastpass):
self.shrinknames = 'shrinknames' in options
self.constfold = 'constfold' in options
self.ifelseswap = 'ifelseswap' in options
self.optlistlength = 'listlength' in options
self.optlistadd = 'listadd' in options
self.dcr = 'dcr' in options