﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
1503	Optimize backend control-flow after symbolic manipulations	Martin Sjölund	Martin Sjölund	"{{{
model M
  Boolean b1 = true;
  Boolean b2 = b1;
  Real x;
  Real y;
algorithm
  if b2 then
    x := 3.5;
  else
    x := 4.5;
  end if;
equation
  when b2 then
    y = 5.5;
  end when;
end M;
}}}

This will surely not be optimized by GCC... We know a constant expression can never trigger an edge event, so why generate this code :)
{{{
  localData->helpVars[0] = (1);
  if (edge(localData->helpVars[0])) {
    $Py = 5.5;
  } else {
    $Py = pre($Py);
  }
}}}

Sure, the if-statement might be optimized by gcc, but eliminating dead code speeds up subsequent traversals of the DAE (including code generation)...
{{{
  if ((1)) {
    /*#modelicaLine [a.mo:8:5-8:13]*/
    $Px = 3.5;
    /*#endModelicaLine*/
  }
  else {
    /*#modelicaLine [a.mo:10:5-10:13]*/
    $Px = 4.5;
    /*#endModelicaLine*/
  }
}}}"	defect	closed	high				fixed		Martin Sjölund Jens Frenkel Willi Braun
