Skip to content

Commit

Permalink
[BE] fixes for inStream
Browse files Browse the repository at this point in the history
fixes if posetiveMax is called for constant

Belonging to [master]:
  - OpenModelica/OMCompiler#2623
  • Loading branch information
vruge authored and OpenModelica-Hudson committed Aug 29, 2018
1 parent 13b403f commit 46d9c5b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Compiler/BackEnd/BackendDAEOptimize.mo
Expand Up @@ -173,10 +173,11 @@ algorithm
then
if simplifyToZero then Expression.createZeroExpression(tp) else Expression.makePureBuiltinCall("max", {e, expr}, tp);

//positiveMax(-cref, eps) = -cref where variable is constant <= 0
case DAE.CALL(path=Absyn.IDENT("$OMC$PositiveMax"),expLst={e, expr}) guard Expression.isNegativeOrZero(e)
//positiveMax(cref, eps) = cref where cref >= 0
case DAE.CALL(path=Absyn.IDENT("$OMC$PositiveMax"),expLst={e, expr}) guard Expression.isPositiveOrZero(e)
then e;

// e.g. positiveMax(cref, eps) = max(cref,eps) = eps where cref < 0
case DAE.CALL(path=Absyn.IDENT("$OMC$PositiveMax"),expLst={e, expr})
//print("\nsimplifyInStreamWork: ");
//print(ExpressionDump.printExpStr(inExp));
Expand Down

0 comments on commit 46d9c5b

Please sign in to comment.