Dead code removal: could we improve it?
Running this command:
dune exec src/main.exe -- -O --display_time --debug --mpp_file mpp_specs/2018_6_7.mpp --mpp_function compute_double_liquidation_pvro --backend python --output aio.py --function_spec m_specs/basic_case.m_spec $(find ir-calcul/sources2018m_6_7/ -name "*.m")
on branch undef_analysis
We get in aio.py:
[...] # no conditional before
rmenage_301400_9 = 0. # line 463
[...] # no conditional in between
rmenage_301400_9 = indmenage_301400_8 * (something big) # line 1783
rcotfor_1_401940_3 = m_max(m_min(0., m_max(id11_511010_0, 0.) - dec11_401140_0 - rmenage_301400_9), 0.) # line 1784
[...] # only conditional after is a VerifCond
During the last run of the dead code elimination, we get:
-
rmenage = indmenage * ...
at block 195, pos 347 -
rmenage
used in varrcotfor_1
, at block 195, pos 348 => sormenage
assignment is not removed since it is later used -
rmenage = 0.
at block 168, pos 347 =>rmenage
assignment is not removed either, I think becauseis_intermediate_def_dominating_later_use 195 348 = false
. However, I think thisrmenage
at (168, 347) should be removed? I tried changing the comparison, but a) I'm lost and b) my attempts resulted in larger generated code files.
@demerigo what do you think?